Last active
April 6, 2020 02:12
-
-
Save mlassi/c8e0d3c749f776a13d637d8c6a65241b to your computer and use it in GitHub Desktop.
serverless framework configuration
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
service: restbucks-lambda-order | |
custom: | |
tableName: '${self:provider.stage}-restbucks-order' | |
snsTopic: "${self:provider.stage}-restbucks-order-topic" | |
provider: | |
name: aws | |
runtime: nodejs12.x | |
stage: dev | |
region: us-east-1 | |
environment: | |
ORDER_TABLE: ${self:custom.tableName} | |
AWS_DEPLOY_REGION: ${self:provider.region} | |
SNS_ORDER_ARN: ${self:custom.snsTopic} | |
iamRoleStatements: | |
- Effect: Allow | |
Action: | |
- dynamodb:PutItem | |
Resource: | |
- { "Fn::GetAtt": ["RestbucksOrderDynamoDBTable", "Arn" ] } | |
- Effect: Allow | |
Action: | |
- SNS:Publish | |
Resource: | |
- { "Fn::Join" : [":", ["arn:aws:sns:${self:provider.region}", { "Ref" : "AWS::AccountId" }, "${self:custom.snsTopic}" ] ] } | |
functions: | |
orderHandler: | |
handler: src/orderHandler.handler | |
environment: | |
SNS_TOPIC_ARN: { "Fn::Join" : [":", ["arn:aws:sns:${self:provider.region}", { "Ref" : "AWS::AccountId" }, "${self:custom.snsTopic}" ] ] } | |
events: | |
- http: | |
path: order | |
method: post | |
cors: true | |
- sns: ${self:provider.stage}-restbucks-order-topic | |
resources: | |
Resources: | |
RestbucksOrderDynamoDBTable: | |
Type: AWS::DynamoDB::Table | |
Properties: | |
AttributeDefinitions: | |
- AttributeName: orderId | |
AttributeType: S | |
KeySchema: | |
- AttributeName: orderId | |
KeyType: HASH | |
ProvisionedThroughput: | |
ReadCapacityUnits: 1 | |
WriteCapacityUnits: 1 | |
TableName: ${self:custom.tableName} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment