To begin with, you’ll need an AWS account. If you already have one, of after creating it, check this guide and the additional links there to see how to get the key id and the secret key, either for the root account or the IAM user. You need to make sure that these credentials have permission to access the SNS resources.
Once these are set up, you can start the tutorial.
I get, key id and the secret key, for un user no root, but I get an error "… is not authorized to perform: SNS:Publish on resource: +51973912122 (ErrorMiddleware.swift:26) ".
The IAM user, have, AmazonSNSFullAccess (AWS managed policy)
SMS is not recommended for 2FA because of security risks both in SS7 vulnerabilities and SIM swapping, and is no longer recommended by NIST. It’s only kind-of okay because an attacker would still need your password (and it’s better than no 2FA).
Your phone number is also not something that is necessarily consistent throughout your life, you could potentially change it and it could be given to someone else.
Using SMS as your only authentication means sounds like a poor security practice.
(the content of the article in general though was very good)
This wouldn’t work for me until I added a second message attribute: “AWS.SNS.SMS.SMSType” which has a value of type SNS.MessageAttributeValue with a stringValue property of “Transactional”. (ie I created an additional entry in the messageAttributes dictionary in the AWSSNSSender class initializer.)
(default is “Promotional”, which I couldn’t get to work even from the AWS console) “Transactional” is suitable for “one-time passcodes” per AWS docs