Created
August 20, 2020 14:13
-
-
Save yeisoncruz16/4d8be5850677bd34c91efc277c1877ee to your computer and use it in GitHub Desktop.
Cloudformation template to create Lambda, SQS, role, Policy, Api
This file contains 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
AWSTemplateFormatVersion: "2010-09-09" | |
Transform: AWS::Serverless-2016-10-31 | |
Description: > | |
Lambda, SQS, role, Policy, Api | |
Globals: | |
Function: | |
Timeout: 5 | |
Runtime: python3.6 | |
Handler: app.lambda_handler | |
Resources: | |
SendMessageToSqs: | |
Type: AWS::Serverless::Function | |
Properties: | |
FunctionName: "LambdaFunctionName" | |
CodeUri: src | |
Description: LambdaFunctionName description | |
Environment: | |
Variables: | |
QUEUE_URL: !GetAtt ProdSQS.Arn | |
Role: !GetAtt LambdaRole.Arn | |
Events: | |
Api1: | |
Type: Api | |
Properties: | |
Path: /custom_endpoint_go_here | |
Method: POST | |
Auth: | |
ApiKeyRequired: True | |
LambdaPolicy: | |
Type: AWS::IAM::ManagedPolicy | |
Properties: | |
PolicyDocument: | |
Version: 2012-10-17 | |
Statement: | |
- Effect: Allow | |
Action: | |
- 'logs:CreateLogGroup' | |
- 'logs:CreateLogStream' | |
- 'logs:PutLogEvents' | |
Resource: '*' | |
- Effect: Allow | |
Action: | |
- 'sqs:SendMessage' | |
Resource: '*' | |
LambdaRole: | |
Type: AWS::IAM::Role | |
Properties: | |
Description: "LambdaRole description" | |
ManagedPolicyArns: | |
- !Ref LambdaPolicy | |
RoleName: "LambdaRole name go here" | |
AssumeRolePolicyDocument: | |
Version: "2012-10-17" | |
Statement: | |
- Effect: "Allow" | |
Principal: | |
Service: | |
- "lambda.amazonaws.com" | |
Action: | |
- "sts:AssumeRole" | |
DevSQS: | |
Type: AWS::SQS::Queue | |
Properties: | |
ContentBasedDeduplication: True | |
FifoQueue: True | |
QueueName: "SQSNameQueueDev.fifo" | |
ProdSQS: | |
Type: AWS::SQS::Queue | |
Properties: | |
ContentBasedDeduplication: True | |
FifoQueue: True | |
QueueName: "SQSNameQueueProd.fifo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment