Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

84 lines (84 sloc) 2.15 KB
AWSTemplateFormatVersion: 2010-09-09
Resources:
Topic:
Type: 'AWS::SNS::Topic'
DynamoDBTable:
Type: 'AWS::DynamoDB::Table'
Properties:
AttributeDefinitions:
- AttributeName: 'id'
AttributeType: 'S'
KeySchema:
- AttributeName: 'id'
KeyType: 'HASH'
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: Account
Function:
Type: 'AWS::Lambda::Function'
Properties:
Handler: index.handler
Runtime: nodejs8.10
Code: .
Role: !GetAtt
- LambdaExecutionRole
- Arn
Timeout: '30'
DependsOn:
- LambdaExecutionRole
Subscription:
Type: 'AWS::SNS::Subscription'
Properties:
Endpoint: !GetAtt
- Function
- Arn
Protocol: lambda
TopicArn: !Ref Topic
DependsOn:
- Function
LambdaInvokePermission:
Type: 'AWS::Lambda::Permission'
Properties:
Action: 'lambda:InvokeFunction'
Principal: sns.amazonaws.com
FunctionName: !GetAtt
- Function
- Arn
SourceArn: !Ref Topic
LambdaExecutionRole:
Type: 'AWS::IAM::Role'
Properties:
Policies:
- PolicyName: LambdaPolicy
PolicyDocument:
Version: 2012-10-17
Statement:
- Action:
- 'logs:CreateLogGroup'
- 'logs:CreateLogStream'
- 'logs:PutLogEvents'
Resource:
- 'arn:aws:logs:*:*:*'
Effect: Allow
- Action:
- 'sns:Subscribe'
- 'sns:Receive'
- 'sns:Unsubscribe'
Resource: !Ref Topic
Effect: Allow
- Action:
- 'dynamodb:PutItem'
Resource: !GetAtt
- DynamoDBTable
- Arn
Effect: Allow
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Action:
- 'sts:AssumeRole'
Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
You can’t perform that action at this time.