From 7e99fa2ca82889f260a2a3b2e087b5b45fdeb9c2 Mon Sep 17 00:00:00 2001 From: Cody Williams <33886790+cpwilliams57@users.noreply.github.com> Date: Tue, 7 Jan 2020 16:44:02 -0600 Subject: [PATCH] Add files via upload --- aws-sns-text/README.md | 28 ++++++++++++++++++++++++++++ aws-sns-text/aws-sns-text.py | 25 +++++++++++++++++++++++++ aws-sns-text/requirements.txt | 9 +++++++++ 3 files changed, 62 insertions(+) create mode 100644 aws-sns-text/README.md create mode 100644 aws-sns-text/aws-sns-text.py create mode 100644 aws-sns-text/requirements.txt diff --git a/aws-sns-text/README.md b/aws-sns-text/README.md new file mode 100644 index 0000000..f2a4f2d --- /dev/null +++ b/aws-sns-text/README.md @@ -0,0 +1,28 @@ +Hello! Thank you for using aws-sns-text.py! +This script should be used to send a text message using the AWS SNS service. + +BEFORE USING +1. In AWS IAM, create a user that has "AmazonSNSFullAcces" privileges +2. Be sure your environment satisfies the reqirements listed in the requirements.txt file + +USAGE INSTRUCTIONS +1. Navigate to your folder containing aws-sns-text.py +2. type "python aws-sns-text.py" to launch the program +3. Enter the key ID obtained through the AWS IAM service +4. Enter the key secret obtained through the AWS IAM service +5. Enter the AWS region where your IAM credentials were created +6. Enter the phone number you wish to send the text +7. Enter the message you wish to send + +Your console output should resemble the following: +Enter AWS key ID: SD78GHMW56BFRWQ3 +Enter AWS key secret: skjef789sdfJOSD9893^&ww90$nweq +Enter AWS region: us-east-1 +Enter phone number: +16248973287 +Enter message: hello world! + +If all fields are entered correctly, the message will send successfully! + + + + diff --git a/aws-sns-text/aws-sns-text.py b/aws-sns-text/aws-sns-text.py new file mode 100644 index 0000000..4eb0676 --- /dev/null +++ b/aws-sns-text/aws-sns-text.py @@ -0,0 +1,25 @@ +#Send a text using AWS sns +import boto3 + +#Retrieve information from the user +key_ID = raw_input("Enter AWS key ID: ") +key_secret = raw_input("Enter AWS key secret: ") +region = raw_input("Enter AWS region: ") +phone = raw_input("Enter phone number: ") +message = raw_input("Enter message: ") + +#create the client +client = boto3.client( + "sns", + aws_access_key_id=key_ID, + aws_secret_access_key=key_secret, + region_name=region +) + +# Send your sms message. +client.publish( + PhoneNumber=phone, + Message=message +) + + diff --git a/aws-sns-text/requirements.txt b/aws-sns-text/requirements.txt new file mode 100644 index 0000000..bdc1960 --- /dev/null +++ b/aws-sns-text/requirements.txt @@ -0,0 +1,9 @@ +boto3==1.10.48 +botocore==1.13.48 +docutils==0.15.2 +futures==3.3.0 +jmespath==0.9.4 +python-dateutil==2.8.1 +s3transfer==0.2.1 +six==1.13.0 +urllib3==1.25.7