-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathtemplate.yaml
59 lines (54 loc) · 1.5 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Idempotency demo
Globals:
Function:
Timeout: 20
Runtime: java11
MemorySize: 512
Tracing: Active
Environment:
Variables:
POWERTOOLS_LOG_LEVEL: INFO
POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
POWERTOOLS_LOGGER_LOG_EVENT: true
Resources:
IdempotencyTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
TimeToLiveSpecification:
AttributeName: expiration
Enabled: true
BillingMode: PAY_PER_REQUEST
IdempotencyFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: .
Handler: helloworld.App::handleRequest
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref IdempotencyTable
Environment:
Variables:
POWERTOOLS_SERVICE_NAME: idempotency
IDEMPOTENCY_TABLE: !Ref IdempotencyTable
Events:
HelloWorld:
Type: Api
Properties:
Path: /helloidem
Method: post
Outputs:
HelloWorldApi:
Description: "API Gateway endpoint URL for Prod stage for Idempotent function"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/helloidem/"
HelloWorldFunction:
Description: "Idempotent Lambda Function ARN"
Value: !GetAtt IdempotencyFunction.Arn