Skip to content

Commit 7824422

Browse files
committed
upgrade to 0.5 project and resource-cf structure
1 parent f0e66b9 commit 7824422

File tree

2 files changed

+156
-162
lines changed

2 files changed

+156
-162
lines changed

s-project.json

Lines changed: 2 additions & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -1,167 +1,7 @@
11
{
22
"name": "serverless-graphql-blog",
3-
"version": "0.0.1",
4-
"profile": "serverless-v0.1.2",
5-
"location": "https://github.com/serverless/serverless-graphql-blog",
6-
"author": "Kevin Old <[email protected]>",
7-
"description": "A Serverless Blog Project",
83
"custom": {},
9-
"templates": {},
104
"plugins": [
115
"serverless-optimizer-plugin"
12-
],
13-
"cloudFormation": {
14-
"AWSTemplateFormatVersion": "2010-09-09",
15-
"Description": "The AWS CloudFormation template for this Serverless application's resources outside of Lambdas and Api Gateway",
16-
"Resources": {
17-
"IamRoleLambda": {
18-
"Type": "AWS::IAM::Role",
19-
"Properties": {
20-
"AssumeRolePolicyDocument": {
21-
"Version": "2012-10-17",
22-
"Statement": [
23-
{
24-
"Effect": "Allow",
25-
"Principal": {
26-
"Service": [
27-
"lambda.amazonaws.com"
28-
]
29-
},
30-
"Action": [
31-
"sts:AssumeRole"
32-
]
33-
}
34-
]
35-
},
36-
"Path": "/"
37-
}
38-
},
39-
"IamPolicyLambda": {
40-
"Type": "AWS::IAM::Policy",
41-
"Properties": {
42-
"PolicyName": "${stage}-${project}-lambda",
43-
"PolicyDocument": {
44-
"Version": "2012-10-17",
45-
"Statement": [
46-
{
47-
"Effect": "Allow",
48-
"Action": [
49-
"logs:CreateLogGroup",
50-
"logs:CreateLogStream",
51-
"logs:PutLogEvents"
52-
],
53-
"Resource": "arn:aws:logs:${region}:*:*"
54-
},
55-
{
56-
"Effect": "Allow",
57-
"Action": [
58-
"*"
59-
],
60-
"Resource": "arn:aws:dynamodb:${region}:*:table/${project}-posts-${stage}"
61-
},
62-
{
63-
"Effect": "Allow",
64-
"Action": [
65-
"*"
66-
],
67-
"Resource": "arn:aws:dynamodb:${region}:*:table/${project}-authors-${stage}"
68-
},
69-
{
70-
"Effect": "Allow",
71-
"Action": [
72-
"*"
73-
],
74-
"Resource": "arn:aws:dynamodb:${region}:*:table/${project}-comments-${stage}"
75-
}
76-
]
77-
},
78-
"Roles": [
79-
{
80-
"Ref": "IamRoleLambda"
81-
}
82-
]
83-
}
84-
},
85-
"PostsDynamo": {
86-
"Type": "AWS::DynamoDB::Table",
87-
"DeletionPolicy": "Retain",
88-
"Properties": {
89-
"AttributeDefinitions": [
90-
{
91-
"AttributeName": "id",
92-
"AttributeType": "S"
93-
}
94-
],
95-
"KeySchema": [
96-
{
97-
"AttributeName": "id",
98-
"KeyType": "HASH"
99-
}
100-
],
101-
"ProvisionedThroughput": {
102-
"ReadCapacityUnits": 1,
103-
"WriteCapacityUnits": 1
104-
},
105-
"TableName": "${project}-posts-${stage}"
106-
}
107-
},
108-
"AuthorsDynamo": {
109-
"Type": "AWS::DynamoDB::Table",
110-
"DeletionPolicy": "Retain",
111-
"Properties": {
112-
"AttributeDefinitions": [
113-
{
114-
"AttributeName": "id",
115-
"AttributeType": "S"
116-
}
117-
],
118-
"KeySchema": [
119-
{
120-
"AttributeName": "id",
121-
"KeyType": "HASH"
122-
}
123-
],
124-
"ProvisionedThroughput": {
125-
"ReadCapacityUnits": 1,
126-
"WriteCapacityUnits": 1
127-
},
128-
"TableName": "${project}-authors-${stage}"
129-
}
130-
},
131-
"CommentsDynamo": {
132-
"Type": "AWS::DynamoDB::Table",
133-
"DeletionPolicy": "Retain",
134-
"Properties": {
135-
"AttributeDefinitions": [
136-
{
137-
"AttributeName": "id",
138-
"AttributeType": "S"
139-
}
140-
],
141-
"KeySchema": [
142-
{
143-
"AttributeName": "id",
144-
"KeyType": "HASH"
145-
}
146-
],
147-
"ProvisionedThroughput": {
148-
"ReadCapacityUnits": 1,
149-
"WriteCapacityUnits": 1
150-
},
151-
"TableName": "${project}-comments-${stage}"
152-
}
153-
}
154-
},
155-
"Outputs": {
156-
"IamRoleArnLambda": {
157-
"Description": "ARN of the lambda IAM role",
158-
"Value": {
159-
"Fn::GetAtt": [
160-
"IamRoleLambda",
161-
"Arn"
162-
]
163-
}
164-
}
165-
}
166-
}
167-
}
6+
]
7+
}

s-resources-cf.json

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
{
2+
"AWSTemplateFormatVersion": "2010-09-09",
3+
"Description": "The AWS CloudFormation template for this Serverless application's resources outside of Lambdas and Api Gateway",
4+
"Resources": {
5+
"IamRoleLambda": {
6+
"Type": "AWS::IAM::Role",
7+
"Properties": {
8+
"AssumeRolePolicyDocument": {
9+
"Version": "2012-10-17",
10+
"Statement": [
11+
{
12+
"Effect": "Allow",
13+
"Principal": {
14+
"Service": [
15+
"lambda.amazonaws.com"
16+
]
17+
},
18+
"Action": [
19+
"sts:AssumeRole"
20+
]
21+
}
22+
]
23+
},
24+
"Path": "/"
25+
}
26+
},
27+
"IamPolicyLambda": {
28+
"Type": "AWS::IAM::Policy",
29+
"Properties": {
30+
"PolicyName": "${stage}-${project}-lambda",
31+
"PolicyDocument": {
32+
"Version": "2012-10-17",
33+
"Statement": [
34+
{
35+
"Effect": "Allow",
36+
"Action": [
37+
"logs:CreateLogGroup",
38+
"logs:CreateLogStream",
39+
"logs:PutLogEvents"
40+
],
41+
"Resource": "arn:aws:logs:${region}:*:*"
42+
},
43+
{
44+
"Effect": "Allow",
45+
"Action": [
46+
"*"
47+
],
48+
"Resource": "arn:aws:dynamodb:${region}:*:table/${project}-posts-${stage}"
49+
},
50+
{
51+
"Effect": "Allow",
52+
"Action": [
53+
"*"
54+
],
55+
"Resource": "arn:aws:dynamodb:${region}:*:table/${project}-authors-${stage}"
56+
},
57+
{
58+
"Effect": "Allow",
59+
"Action": [
60+
"*"
61+
],
62+
"Resource": "arn:aws:dynamodb:${region}:*:table/${project}-comments-${stage}"
63+
}
64+
]
65+
},
66+
"Roles": [
67+
{
68+
"Ref": "IamRoleLambda"
69+
}
70+
]
71+
}
72+
},
73+
"PostsDynamo": {
74+
"Type": "AWS::DynamoDB::Table",
75+
"DeletionPolicy": "Retain",
76+
"Properties": {
77+
"AttributeDefinitions": [
78+
{
79+
"AttributeName": "id",
80+
"AttributeType": "S"
81+
}
82+
],
83+
"KeySchema": [
84+
{
85+
"AttributeName": "id",
86+
"KeyType": "HASH"
87+
}
88+
],
89+
"ProvisionedThroughput": {
90+
"ReadCapacityUnits": 1,
91+
"WriteCapacityUnits": 1
92+
},
93+
"TableName": "${project}-posts-${stage}"
94+
}
95+
},
96+
"AuthorsDynamo": {
97+
"Type": "AWS::DynamoDB::Table",
98+
"DeletionPolicy": "Retain",
99+
"Properties": {
100+
"AttributeDefinitions": [
101+
{
102+
"AttributeName": "id",
103+
"AttributeType": "S"
104+
}
105+
],
106+
"KeySchema": [
107+
{
108+
"AttributeName": "id",
109+
"KeyType": "HASH"
110+
}
111+
],
112+
"ProvisionedThroughput": {
113+
"ReadCapacityUnits": 1,
114+
"WriteCapacityUnits": 1
115+
},
116+
"TableName": "${project}-authors-${stage}"
117+
}
118+
},
119+
"CommentsDynamo": {
120+
"Type": "AWS::DynamoDB::Table",
121+
"DeletionPolicy": "Retain",
122+
"Properties": {
123+
"AttributeDefinitions": [
124+
{
125+
"AttributeName": "id",
126+
"AttributeType": "S"
127+
}
128+
],
129+
"KeySchema": [
130+
{
131+
"AttributeName": "id",
132+
"KeyType": "HASH"
133+
}
134+
],
135+
"ProvisionedThroughput": {
136+
"ReadCapacityUnits": 1,
137+
"WriteCapacityUnits": 1
138+
},
139+
"TableName": "${project}-comments-${stage}"
140+
}
141+
}
142+
},
143+
"Outputs": {
144+
"IamRoleArnLambda": {
145+
"Description": "ARN of the lambda IAM role",
146+
"Value": {
147+
"Fn::GetAtt": [
148+
"IamRoleLambda",
149+
"Arn"
150+
]
151+
}
152+
}
153+
}
154+
}

0 commit comments

Comments
 (0)