|
| 1 | +AWSTemplateFormatVersion: '2010-09-09' |
| 2 | +Transform: 'AWS::Serverless-2016-10-31' |
| 3 | +Description: 'SAM template for Serverless framework service: ' |
| 4 | +Resources: |
| 5 | + restaurantsTable: |
| 6 | + Type: 'AWS::DynamoDB::Table' |
| 7 | + Properties: |
| 8 | + TableName: restaurants |
| 9 | + AttributeDefinitions: |
| 10 | + - AttributeName: name |
| 11 | + AttributeType: S |
| 12 | + KeySchema: |
| 13 | + - AttributeName: name |
| 14 | + KeyType: HASH |
| 15 | + ProvisionedThroughput: |
| 16 | + ReadCapacityUnits: 1 |
| 17 | + WriteCapacityUnits: 1 |
| 18 | + GetIndex: |
| 19 | + Type: 'AWS::Serverless::Function' |
| 20 | + Properties: |
| 21 | + Handler: functions/get-index.handler |
| 22 | + Runtime: nodejs6.10 |
| 23 | + CodeUri: >- |
| 24 | + /Users/yancui/SourceCode/Personal/manning-aws-lambda-operational-patterns-and-practices/.serverless/big-mouth.zip |
| 25 | + MemorySize: 128 |
| 26 | + Timeout: 3 |
| 27 | + Policies: |
| 28 | + - Effect: Allow |
| 29 | + Action: 'dynamodb:scan' |
| 30 | + Resource: 'arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/restaurants' |
| 31 | + Environment: |
| 32 | + Variables: |
| 33 | + restaurants_api: https://i3c5h755j0.execute-api.us-east-1.amazonaws.com/dev/restaurants |
| 34 | + cognito_user_pool_id: us-east-1_DfuAwa0vB |
| 35 | + cognito_client_id: 1tf8pb1s1n53p7u608e7ic5ih8 |
| 36 | + Events: |
| 37 | + Event1: |
| 38 | + Type: Api |
| 39 | + Properties: |
| 40 | + Path: / |
| 41 | + Method: get |
| 42 | + GetRestaurants: |
| 43 | + Type: 'AWS::Serverless::Function' |
| 44 | + Properties: |
| 45 | + Handler: functions/get-restaurants.handler |
| 46 | + Runtime: nodejs6.10 |
| 47 | + CodeUri: >- |
| 48 | + /Users/yancui/SourceCode/Personal/manning-aws-lambda-operational-patterns-and-practices/.serverless/big-mouth.zip |
| 49 | + MemorySize: 128 |
| 50 | + Timeout: 3 |
| 51 | + Policies: |
| 52 | + - Effect: Allow |
| 53 | + Action: 'dynamodb:scan' |
| 54 | + Resource: 'arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/restaurants' |
| 55 | + Environment: |
| 56 | + Variables: |
| 57 | + restaurants_table: restaurants |
| 58 | + Events: |
| 59 | + Event1: |
| 60 | + Type: Api |
| 61 | + Properties: |
| 62 | + Path: /restaurants/ |
| 63 | + Method: get |
| 64 | + Aws_iamResourcePolicy: |
| 65 | + Type: 'AWS::Lambda::Permission' |
| 66 | + Properties: |
| 67 | + Action: 'lambda:InvokeFunction' |
| 68 | + FunctionName: |
| 69 | + 'Fn::GetAtt': |
| 70 | + - Aws_iam |
| 71 | + - Arn |
| 72 | + Principal: apigateway.amazonaws.com |
| 73 | + SourceAccount: |
| 74 | + Ref: 'AWS::AccountId' |
| 75 | + SearchRestaurants: |
| 76 | + Type: 'AWS::Serverless::Function' |
| 77 | + Properties: |
| 78 | + Handler: functions/search-restaurants.handler |
| 79 | + Runtime: nodejs6.10 |
| 80 | + CodeUri: >- |
| 81 | + /Users/yancui/SourceCode/Personal/manning-aws-lambda-operational-patterns-and-practices/.serverless/big-mouth.zip |
| 82 | + MemorySize: 128 |
| 83 | + Timeout: 3 |
| 84 | + Policies: |
| 85 | + - Effect: Allow |
| 86 | + Action: 'dynamodb:scan' |
| 87 | + Resource: 'arn:aws:dynamodb:#{AWS::Region}:#{AWS::AccountId}:table/restaurants' |
| 88 | + Environment: |
| 89 | + Variables: |
| 90 | + restaurants_table: restaurants |
| 91 | + Events: |
| 92 | + Event1: |
| 93 | + Type: Api |
| 94 | + Properties: |
| 95 | + Path: /restaurants/search |
| 96 | + Method: post |
0 commit comments