-
Notifications
You must be signed in to change notification settings - Fork 0
/
archiver.yml
105 lines (104 loc) · 2.81 KB
/
archiver.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
AWSTemplateFormatVersion: "2010-09-09"
Description:
This script create the resources for the Lambda function deployment
Parameters:
InvoiceBucketName:
Type: String
Description: Bucket name where the invoices will be stored
EnvType:
Type: String
Description: Environment Type
Default: prod
AllowedValues:
- prod
- test
ConstraintDescription: You must specify prod or test
Conditions:
IsProdEnv: !Equals [!Ref EnvType, prod]
Resources:
InvoiceSenderTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: sender
AttributeType: S
KeySchema:
- AttributeName: sender
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: "2"
WriteCapacityUnits: "2"
TableName: WhitelistSender
CompanyNameTable:
Type: AWS::DynamoDB::Table
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: "2"
WriteCapacityUnits: "2"
TableName: Company
InvoiceBucket:
Type: AWS::S3::Bucket
Condition: IsProdEnv
Properties:
BucketName: !Ref InvoiceBucketName
InvoiceRole:
Type: AWS::IAM::Role
DependsOn: "InvoiceSenderTable"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service:
- lambda.amazonaws.com
- events.amazonaws.com
Action: "sts:AssumeRole"
Policies:
- PolicyName: root
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Action:
- "logs:*"
Resource: "arn:aws:logs:*:*:*"
- Effect: Allow
Action:
- "lambda:InvokeFunction"
Resource: "*"
- Effect: Allow
Action:
- "s3:*"
Resource: "*"
- Effect: Allow
Action:
- "kms:Decrypt"
Resource: "*"
- Effect: Allow
Action:
- "dynamodb:DescribeTable"
- "dynamodb:BatchGetItem"
- "dynamodb:DescribeTable"
- "dynamodb:GetItem"
- "dynamodb:ListTables"
- "dynamodb:Query"
- "dynamodb:Scan"
- "dynamodb:DescribeReservedCapacity"
- "dynamodb:DescribeReservedCapacityOfferings"
- "dynamodb:ListTagsOfResource"
- "dynamodb:DescribeTimeToLive"
- "dynamodb:DescribeLimits"
Resource: "*"
Path: /
RoleName: InvoiceArchiverRole
Outputs:
InvoiceRoleArn:
Value: !GetAtt InvoiceRole.Arn
Description: Arn for Zappa Role