Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An example app with a Lambda function that sends texts via SNS.
Parameters:
# Pass secrets that you don't want stored in your code repository as parameters
MyPhoneNumber:
Type: String
Resources:
CICDSendTextFunction:
# A Lambda function that sends messages to an SNS topic
Type: 'AWS::Serverless::Function'
Properties:
FunctionName: CICDSendTextFunction
Handler: send_text_function.lambda_handler
Runtime: python3.7
Description: A Lambda function that sends text messages
Timeout: 120
Policies:
# Find more SAM IAM policy templates here: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-policy-templates.html
- SNSPublishMessagePolicy:
# Our function only has permissions to send to the SNS topic we created
TopicName: !GetAtt CICDSendTextSNSTopic.TopicName
Environment:
Variables:
# If your functions need to use variables passed as parameters, reference them as environment variables
MY_PHONE_NUMBER: !Ref MyPhoneNumber
# You can also reference other resources created in this template as environment variables
SNS_TOPIC_ARN: !Ref CICDSendTextSNSTopic
CICDSendTextSNSTopic:
# An SNS topic
Type: AWS::SNS::Topic
Properties:
# Subscribing yourself to receive messages from this topic
Subscription:
- Protocol: sms
Endpoint: !Ref MyPhoneNumber