-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.yaml
98 lines (97 loc) · 2.86 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
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
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An AWS Lambda function to read csv file content from a S3 bucket, manipulate records, and insert or update records to target DynamoDB tables.
Parameters:
S3BucketName:
Type: String
APPIMGROOTPATH:
Type: String
CollectionCategory:
Type: String
DYNOCollectionTABLE:
Type: String
DYNOArchiveTABLE:
Type: String
DYNOCollectionmapTABLE:
Type: String
NOIDNAA:
Type: String
Default: "53696"
NOIDScheme:
Type: String
Default: "ark:/"
REGION:
Type: String
Default: "us-east-1"
LongURLPath:
Type: String
ShortURLPath:
Type: String
APIKey:
Type: String
APIEndpoint:
Type: String
NoidLayerArn:
Type: String
Default: "arn:aws:lambda:us-east-1:909117335741:layer:noid-layer:6"
Resources:
s3toddb:
Type: 'AWS::Serverless::Function'
Properties:
Handler: lambda_function.lambda_handler
Runtime: python3.7
CodeUri: .
Description: An AWS Lambda function to read csv file content from a S3 bucket, manipulate records, and insert or update records to target DynamoDB tables.
MemorySize: 2048
Timeout: 300
Layers:
- !Ref NoidLayerArn
Policies:
- DynamoDBCrudPolicy:
TableName: !Ref DYNOCollectionTABLE
- DynamoDBCrudPolicy:
TableName: !Ref DYNOArchiveTABLE
- DynamoDBCrudPolicy:
TableName: !Ref DYNOCollectionmapTABLE
- S3ReadPolicy:
BucketName: !Ref S3BucketName
Events:
BucketEvent1:
Type: S3
Properties:
Bucket:
Ref: SourceS3Bucket
Events:
- 's3:ObjectCreated:*'
Environment:
Variables:
DEBUG: 1
APP_IMG_ROOT_PATH: !Ref APPIMGROOTPATH
Collection_Category: !Ref CollectionCategory
DYNO_Collection_TABLE: !Ref DYNOCollectionTABLE
DYNO_Archive_TABLE: !Ref DYNOArchiveTABLE
DYNO_Collectionmap_TABLE: !Ref DYNOCollectionmapTABLE
NOID_NAA: !Ref NOIDNAA
NOID_Scheme: !Ref NOIDScheme
REGION: !Ref REGION
LONG_URL_PATH: !Ref LongURLPath
SHORT_URL_PATH: !Ref ShortURLPath
API_KEY: !Ref APIKey
API_ENDPOINT: !Ref APIEndpoint
SourceS3Bucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !Ref S3BucketName
Outputs:
s3toddbFunction:
Description: "s3toddb Lambda Function ARN"
Value: !GetAtt s3toddb.Arn
s3toddbFunctionName:
Description: "s3toddb Lambda Function name"
Value: !Ref s3toddb
s3toddbIamRole:
Description: "Implicit IAM Role created for Noid function"
Value: !GetAtt s3toddbRole.Arn
s3toddbBucket:
Description: "s3toddbBucket Bucket name"
Value: !Ref S3BucketName