-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.yaml
61 lines (58 loc) · 1.63 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: An AWS Serverless Application to converse with OpenAI agent
Resources:
SessionTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: SessionTable
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: SessionId
AttributeType: S
- AttributeName: LastUpdated
AttributeType: S
KeySchema:
- AttributeName: SessionId
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: TimestampIndex
KeySchema:
- AttributeName: SessionId
KeyType: HASH
- AttributeName: LastUpdated
KeyType: RANGE
Projection:
ProjectionType: ALL
EmailReportFunction:
Type: AWS::Serverless::Function
Properties:
PackageType: Image
ImageConfig:
Command: [ "app.lambda_handler" ]
Timeout: 60
Environment:
Variables:
SESSION_TABLE_NAME: !Ref SessionTable
Events:
DailyTrigger:
Type: Schedule
Properties:
Schedule: cron(0 6 * * ? *)
Policies:
- AmazonDynamoDBFullAccess
- Statement:
- Effect: Allow
Action:
- ses:SendEmail
- ses:SendRawEmail
Resource: "*"
- Statement:
- Effect: Allow
Action:
- ssm:GetParameter
Resource: arn:aws:ssm:us-east-1:047672427450:parameter/FROM_EMAIL
Metadata:
Dockerfile: Dockerfile.report
DockerContext: .
DockerTag: v1