-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yml
More file actions
40 lines (36 loc) · 1.12 KB
/
template.yml
File metadata and controls
40 lines (36 loc) · 1.12 KB
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Resources:
TransactionsTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: !Sub transactions-${AWS::StackName}
AttributeDefinitions:
- AttributeName: transaction_id
AttributeType: S
KeySchema:
- AttributeName: transaction_id
KeyType: HASH
BillingMode: PAY_PER_REQUEST
PaymentFunction:
Type: AWS::Serverless::Function
Properties:
Handler: lambdas/process_payment.lambda_handler
Runtime: python3.12
CodeUri: .
Environment:
Variables:
TRANSACTIONS_TABLE: !Sub transactions-${AWS::StackName}
Policies:
- DynamoDBCrudPolicy:
TableName: !Sub transactions-${AWS::StackName}
Events:
PaymentAPI:
Type: Api
Properties:
Path: /pay
Method: post
Outputs:
PaymentApiUrl:
Description: "API Gateway endpoint URL for Prod stage"
Value: !Sub "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/pay"