Created
June 18, 2019 13:22
-
-
Save ddepaoli3/f1021064fae5481b485fadf3cb78bf0a to your computer and use it in GitHub Desktop.
Send SMS using aws sns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ./send_sms.sh +3934091929 "ciao ciao" "profile-name" | |
#Comand to set the default sender Name, i.e. the name you see in sms in the field 'from' | |
#aws --profile aws-profile sns set-sms-attributes --attributes DefaultSenderID=SenderName | |
NUMBER=$1 | |
MESSAGE=$2 | |
PROFILE=$3 | |
TOPICARN=`aws sns create-topic --profile $PROFILE --name test-cli | python -c 'import json,sys;obj=json.load(sys.stdin);print obj["TopicArn"]'` | |
aws sns subscribe --profile $PROFILE --protocol sms --notification-endpoint $NUMBER --topic-arn "$TOPICARN" | |
aws sns publish --profile $PROFILE --target-arn "$TOPICARN" --message "$MESSAGE" | |
aws sns delete-topic --profile $PROFILE --topic-arn "$TOPICARN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment