@@ -9,8 +9,32 @@ provider:
99 memorySize : 512
1010 timeout : 15
1111
12+ vpc :
13+ securityGroupIds :
14+ - ' Fn::ImportValue ' : ${self:custom.networkStack}-PrivateSG
15+ subnetIds :
16+ - ' Fn::ImportValue ' : ${self:custom.networkStack}-PrivateSubnet1
17+ - ' Fn::ImportValue ' : ${self:custom.networkStack}-PrivateSubnet2
18+
1219 iamRoleStatements :
13- - Effect : Allow # access to DynamoDB
20+ - Effect : Allow # access to API Gateway
21+ Action :
22+ - execute-api:Invoke
23+ Resource :
24+ # Allow access to our own APIs
25+ - ' Fn::Join ' :
26+ - ' :'
27+ -
28+ - arn:aws:execute-api
29+ - Ref : ' AWS::Region'
30+ - Ref : ' AWS::AccountId'
31+ - ' Fn::Join ' :
32+ - ' /'
33+ -
34+ - Ref : ApiGatewayRestApi
35+ - ' */*/*'
36+ - Effect : Allow
37+ # access to DynamoDB
1438 Action :
1539 - dynamodb:*
1640 Resource :
@@ -43,12 +67,18 @@ provider:
4367plugins :
4468 - serverless-offline
4569 - serverless-webpack
70+ - serverless-plugin-warmup
4671 - serverless-aws-alias
4772
4873custom :
4974 stage : ${opt:stage, self:provider.stage}
5075 region : ${opt:region, self:provider.region}
5176
77+ # Stack names for references
78+ networkStack : stashimi-${self:custom.stage}
79+
80+ newService : ${self:}
81+
5282 # Stage dependent variables.
5383 # Usage: ${self:custom.${self:custom.stage}.<varname>}
5484 dev :
@@ -64,38 +94,18 @@ functions:
6494 testfct1 :
6595 description : ' Echo function echoes alias'
6696 handler : handlers/testfct1/handler.handle
97+ warmup : true
6798 events :
6899 - http :
69100 method : GET
70101 path : /func1
71- - stream :
72- type : dynamodb
73- arn :
74- Fn::GetAtt :
75- - TestDynamoDbTable
76- - StreamArn
102+ # authorizer:
103+ # name: myAuth
104+ # identitySource: method.request.header.Authorization
105+ # resultTtlInSeconds: 0
106+ # arn: arn:aws:lambda:us-east-1:XXXXXXX:function:profile-access-token
77107
78108resources :
79109 Resources :
80110
81- TestDynamoDbTable :
82- Type : AWS::DynamoDB::Table
83- DeletionPolicy : Delete
84- Properties :
85- AttributeDefinitions :
86- - AttributeName : myKey
87- AttributeType : S
88- KeySchema :
89- - AttributeName : myKey
90- KeyType : HASH
91- ProvisionedThroughput :
92- ReadCapacityUnits : 1
93- WriteCapacityUnits : 1
94- StreamSpecification :
95- StreamViewType : NEW_AND_OLD_IMAGES
96-
97111 Outputs :
98- TestDynamoDbTableName :
99- Description : Test DynamoDB Table Name
100- Value :
101- Ref : TestDynamoDbTable
0 commit comments