-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathserverless.template
More file actions
109 lines (109 loc) · 2.94 KB
/
Copy pathserverless.template
File metadata and controls
109 lines (109 loc) · 2.94 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
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
106
107
108
109
{
"Description": "Simple article service.",
"Parameters" : {
"ArticleBucketName" : {
"Type" : "String",
"Default" : "serverless-blueprint-article-bucket-23648817236827281",
"Description" : "Name of S3 bucket used to store the article content. If left blank a new bucket will be created.",
"MinLength" : "0"
},
"ArticleTableName" : {
"Type" : "String",
"Default" : "serverless-blueprint-article-table",
"Description" : "Name of DynamoDB table used to store the article metadata. If left blank a new table will be created.",
"MinLength" : "0"
},
"ReadCapacity" : {
"Type" : "Number",
"Description" : "Read capacity for the DynamoDB blog table.",
"Default" : "3",
"MinValue" : 1
},
"WriteCapacity" : {
"Type" : "Number",
"Description" : "Write capacity for the DynamoDB blog table.",
"Default" : "3",
"MinValue" : 1
}
},
"Resources": {
"GetArticle": {
"Type": "AWS::Serverless::Function",
"Properties": {
"Handler": "GetArticle",
"Policies": [
"AmazonDynamoDBReadOnlyAccess",
"AmazonS3ReadOnlyAccess"
],
"Environment" : {
"Variables" : {
"ARTICLE_TABLE_NAME" : { "Ref" : "ArticleTableName" },
"ARTICLE_BUCKET_NAME" : { "Ref" : "ArticleBucketName" }
}
},
"Events": {
"GetResource": {
"Type": "Api",
"Properties": {
"Path": "/",
"Method": "get"
}
}
}
}
},
"PutArticle": {
"Type": "AWS::Serverless::Function",
"Properties": {
"Handler": "PutArticle",
"Policies": [
"AmazonDynamoDBFullAccess",
"AmazonS3FullAccess"
],
"Environment" : {
"Variables" : {
"ARTICLE_TABLE_NAME" : { "Ref" : "ArticleTableName" },
"ARTICLE_BUCKET_NAME" : { "Ref" : "ArticleBucketName" }
}
},
"Events": {
"PutResource": {
"Type": "Api",
"Properties": {
"Path": "/",
"Method": "post"
}
}
}
}
},
"ArticleTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"AttributeDefinitions": [
{
"AttributeName": "id",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "id",
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": {"Ref" : "ReadCapacity"},
"WriteCapacityUnits": {"Ref" : "WriteCapacity"}
},
"TableName": {"Ref" : "ArticleTableName"}
}
},
"ArticleBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": {"Ref" : "ArticleBucketName"}
}
}
}
}