-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.yaml
68 lines (59 loc) · 1.48 KB
/
template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Using Ruby with AWS Lambda & SAM by 757rb.org
Parameters:
StageName:
Type: String
Default: dev
AllowedValues:
- dev
- test
- staging
- prod
Resources:
MyFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: app/
Handler: app.handler
Runtime: ruby2.5
MemorySize: 256
Timeout: 10
Environment:
Variables:
STAGE: !Ref StageName
Policies:
- Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- dynamodb:*
Resource:
- !GetAtt PlosSearchTable.Arn
Events:
MyApi:
Type: Api
Properties:
Path: /{resource+}
Method: get
PlosSearchTable:
Type: AWS::Serverless::SimpleTable
Properties:
TableName: !Join
- ''
- - plos-search
- '-'
- !Ref StageName
PrimaryKey:
Name: id
Type: String
Outputs:
MyApi:
Description: API Gateway endpoint URL for Prod stage for Hello World function
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/hello/"
Function:
Description: Lambda function ARN.
Value: !GetAtt MyFunction.Arn
FunctionIamRole:
Description: Implicit IAM Role created for the function.
Value: !GetAtt MyFunctionRole.Arn