Here is some example code that used an AWS cloudformation template to create an IAM user/group that has access to send SMS messages via SNS
There are 2 python3 scripts.
aws-python-sms-create-creds.py uses a cloudformation template to create an IAM user with permissions to send SNS messages. The AccessKey and SecretKey are written to a config file called aws-python-sms-create-creds.config
aws-python-sms-send-message.py uses the credentials created to send an SMS message via AWS SNS