-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yml
71 lines (66 loc) · 1.8 KB
/
template.yml
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
69
70
71
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Stack for Stori's Transactions Email Sender
Parameters:
Project:
Description: "Project name."
Type: "String"
Default: "stori-transactions-email-sender"
Stage:
Description: "Stage name, should be dev or prod."
Type: "String"
AllowedValues:
- "dev"
- "prod"
BucketName:
Description: "Bucket name to store files."
Type: "String"
SecretName:
Description: "Enail sender servide secret name."
Type: "String"
Globals:
Function:
Timeout: 30
Resources:
Function:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub "${Project}-${Stage}-api"
MemorySize: 512
CodeUri: .
Handler: src.api.main.handler
Runtime: python3.12
Environment:
Variables:
BUCKET_NAME: !Ref BucketName
SECRET_NAME: !Ref SecretName
STAGE: !Ref Stage
Events:
Api:
Type: HttpApi
Properties:
ApiId: !Ref Api
Policies:
Policies:
- AWSSecretsManagerGetSecretValuePolicy:
SecretArn: !Sub 'arn:aws:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:stori*'
- S3FullAccessPolicy:
BucketName: !Ref BucketName
VpcConfig:
SecurityGroupIds:
- sg-0caac4ee042ea071e
- sg-06773d9f2a2418747
SubnetIds:
- subnet-0eba33baff274049b
- subnet-00326eed251a41661
- subnet-0d6d5af9444661658
- subnet-0d1cd1f453b97c1dd
Api:
Name: !Sub "${Project}-${Stage}-http-api"
Type: AWS::Serverless::HttpApi
SrageName: !Ref Stage
Outputs:
ApiUrl:
Description: API endpoint URL
Value:
Fn::Sub: 'https://${Api}.execute-api.${AWS::Region}.${AWS::URLSuffix}/'