Skip to content

Commit 156bfae

Browse files
committed
refactor: Ensure use of modern iam.role syntax
1 parent 3c8a2e3 commit 156bfae

File tree

26 files changed

+293
-246
lines changed

26 files changed

+293
-246
lines changed

aws-ffmpeg-layer/serverless.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
service: gifmaker
2-
frameworkVersion: ">=1.34.0 <2.0.0"
2+
frameworkVersion: ">=2.24.0"
33

44
provider:
55
name: aws

aws-golang-dynamo-stream-to-elasticsearch/serverless.yml

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,34 @@ provider:
66
environment:
77
ELASTICSEARCH_URL:
88
Fn::GetAtt: ["PuppySearch", "DomainEndpoint"]
9-
10-
iamRoleStatements:
11-
- Effect: Allow
12-
Action:
13-
- 'dynamodb:ListTables'
14-
- 'dynamodb:DescribeTable'
15-
- 'dynamodb:DescribeStream'
16-
- 'dynamodb:ListStreams'
17-
- 'dynamodb:GetShardIterator'
18-
- 'dynamodb:BatchGetItem'
19-
- 'dynamodb:GetItem'
20-
- 'dynamodb:Query'
21-
- 'dynamodb:Scan'
22-
- 'dynamodb:DescribeReservedCapacity'
23-
- 'dynamodb:DescribeReservedCapacityOfferings'
24-
- 'dynamodb:GetRecords'
25-
Resource:
26-
- { "Fn::GetAtt": ["PuppyDemo", "Arn"] }
27-
- Effect: Allow
28-
Action:
29-
- es:ESHttpPost
30-
- es:ESHttpPut
31-
- es:ESHttpDelete
32-
- es:ESHttpGet
33-
Resource:
34-
- { "Fn::GetAtt": ["PuppySearch", "DomainArn"] }
35-
- { "Fn::Join": ["", ["Fn::GetAtt": ["PuppySearch", "DomainArn"], "/*"]] }
9+
iam:
10+
role:
11+
statements:
12+
- Effect: Allow
13+
Action:
14+
- 'dynamodb:ListTables'
15+
- 'dynamodb:DescribeTable'
16+
- 'dynamodb:DescribeStream'
17+
- 'dynamodb:ListStreams'
18+
- 'dynamodb:GetShardIterator'
19+
- 'dynamodb:BatchGetItem'
20+
- 'dynamodb:GetItem'
21+
- 'dynamodb:Query'
22+
- 'dynamodb:Scan'
23+
- 'dynamodb:DescribeReservedCapacity'
24+
- 'dynamodb:DescribeReservedCapacityOfferings'
25+
- 'dynamodb:GetRecords'
26+
Resource:
27+
- { "Fn::GetAtt": ["PuppyDemo", "Arn"] }
28+
- Effect: Allow
29+
Action:
30+
- es:ESHttpPost
31+
- es:ESHttpPut
32+
- es:ESHttpDelete
33+
- es:ESHttpGet
34+
Resource:
35+
- { "Fn::GetAtt": ["PuppySearch", "DomainArn"] }
36+
- { "Fn::Join": ["", ["Fn::GetAtt": ["PuppySearch", "DomainArn"], "/*"]] }
3637

3738
package:
3839
exclude:

aws-golang-googlemap/serverless.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ service: gomapservice # NOTE: update this with your service name
1616
# You can pin your service to only deploy with a specific Serverless version
1717
# Check out our docs for more details
1818
# frameworkVersion: "=X.X.X"
19-
frameworkVersion: ">=1.28.0 <2.0.0"
19+
frameworkVersion: ">=2.24.0"
2020

2121
provider:
2222
name: aws
@@ -29,20 +29,22 @@ provider:
2929
region: ap-southeast-1
3030

3131
# you can add statements to the Lambda function's IAM Role here
32-
# iamRoleStatements:
33-
# - Effect: "Allow"
34-
# Action:
35-
# - "s3:ListBucket"
36-
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] }
37-
# - Effect: "Allow"
38-
# Action:
39-
# - "s3:PutObject"
40-
# Resource:
41-
# Fn::Join:
42-
# - ""
43-
# - - "arn:aws:s3:::"
44-
# - "Ref" : "ServerlessDeploymentBucket"
45-
# - "/*"
32+
# iam:
33+
# role:
34+
# statements:
35+
# - Effect: "Allow"
36+
# Action:
37+
# - "s3:ListBucket"
38+
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] }
39+
# - Effect: "Allow"
40+
# Action:
41+
# - "s3:PutObject"
42+
# Resource:
43+
# Fn::Join:
44+
# - ""
45+
# - - "arn:aws:s3:::"
46+
# - "Ref" : "ServerlessDeploymentBucket"
47+
# - "/*"
4648

4749
# you can define service wide environment variables here
4850
# environment:

aws-golang-http-get-post/serverless.yml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ service: goservice # NOTE: update this with your service name
1616
# You can pin your service to only deploy with a specific Serverless version
1717
# Check out our docs for more details
1818
# frameworkVersion: "=X.X.X"
19-
frameworkVersion: ">=1.28.0 <2.0.0"
19+
frameworkVersion: ">=2.24.0"
2020

2121
provider:
2222
name: aws
@@ -26,21 +26,24 @@ provider:
2626
# stage: dev
2727
# region: us-east-1
2828

29+
2930
# you can add statements to the Lambda function's IAM Role here
30-
# iamRoleStatements:
31-
# - Effect: "Allow"
32-
# Action:
33-
# - "s3:ListBucket"
34-
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] }
35-
# - Effect: "Allow"
36-
# Action:
37-
# - "s3:PutObject"
38-
# Resource:
39-
# Fn::Join:
40-
# - ""
41-
# - - "arn:aws:s3:::"
42-
# - "Ref" : "ServerlessDeploymentBucket"
43-
# - "/*"
31+
# iam:
32+
# role:
33+
# statements:
34+
# - Effect: "Allow"
35+
# Action:
36+
# - "s3:ListBucket"
37+
# Resource: { "Fn::Join" : ["", ["arn:aws:s3:::", { "Ref" : "ServerlessDeploymentBucket" } ] ] }
38+
# - Effect: "Allow"
39+
# Action:
40+
# - "s3:PutObject"
41+
# Resource:
42+
# Fn::Join:
43+
# - ""
44+
# - - "arn:aws:s3:::"
45+
# - "Ref" : "ServerlessDeploymentBucket"
46+
# - "/*"
4447

4548
# you can define service wide environment variables here
4649
# environment:

aws-golang-rest-api-with-dynamodb/serverless.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
app: aws-golang-rest-api-with-dynamodb
22
service: aws-golang-rest-api-with-dynamodb
33

4-
frameworkVersion: ">=1.1.0 <=2.1.1"
4+
frameworkVersion: ">=2.24.0"
55

66
provider:
77
name: aws
88
runtime: go1.x
99
environment:
1010
DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
11-
iamRoleStatements:
12-
- Effect: Allow
13-
Action:
14-
- dynamodb:Query
15-
- dynamodb:Scan
16-
- dynamodb:GetItem
17-
- dynamodb:PutItem
18-
- dynamodb:UpdateItem
19-
- dynamodb:DeleteItem
20-
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
11+
iam:
12+
role:
13+
statements:
14+
- Effect: Allow
15+
Action:
16+
- dynamodb:Query
17+
- dynamodb:Scan
18+
- dynamodb:GetItem
19+
- dynamodb:PutItem
20+
- dynamodb:UpdateItem
21+
- dynamodb:DeleteItem
22+
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
2123

2224
functions:
2325
create:

aws-golang-s3-file-replicator/serverless.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
service: aws-golang-s3-file-replicator
2-
frameworkVersion: ">=1.28.0 <2.0.0"
2+
frameworkVersion: ">=2.24.0"
33

44
custom:
55
inputBucket: replicator-input-101
@@ -12,15 +12,17 @@ provider:
1212
region: ap-northeast-1
1313
memorySize: 128
1414
timeout: 30
15-
iamRoleStatements:
16-
- Effect: Allow
17-
Action:
18-
- s3:*
19-
Resource: "arn:aws:s3:::${self:custom.outputBucket}/*"
20-
- Effect: Allow
21-
Action:
22-
- s3:*
23-
Resource: "arn:aws:s3:::${self:custom.inputBucket}/*"
15+
iam:
16+
role:
17+
statements:
18+
- Effect: Allow
19+
Action:
20+
- s3:*
21+
Resource: "arn:aws:s3:::${self:custom.outputBucket}/*"
22+
- Effect: Allow
23+
Action:
24+
- s3:*
25+
Resource: "arn:aws:s3:::${self:custom.inputBucket}/*"
2426

2527
package:
2628
exclude:

aws-node-dynamodb-backup/serverless.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@ provider:
99
name: aws
1010
runtime: nodejs12.x
1111
stage: staging
12-
iamRoleStatements:
13-
- Effect: Allow
14-
Action:
15-
- s3:PutObject
16-
Resource: "arn:aws:s3:::${self:custom.bucket}/${self:custom.prefix}/${self:custom.dynamoDBTableName}/*"
17-
- Effect: Allow
18-
Action:
19-
- "dynamodb:GetRecords"
20-
- "dynamodb:GetShardIterator"
21-
- "dynamodb:DescribeStream"
22-
- "dynamodb:ListStreams"
23-
Resource: "arn:aws:dynamodb:ap-southeast-1:*:table/${self:custom.dynamoDBTableName}/stream/*"
12+
iam:
13+
role:
14+
statements:
15+
- Effect: Allow
16+
Action:
17+
- s3:PutObject
18+
Resource: "arn:aws:s3:::${self:custom.bucket}/${self:custom.prefix}/${self:custom.dynamoDBTableName}/*"
19+
- Effect: Allow
20+
Action:
21+
- "dynamodb:GetRecords"
22+
- "dynamodb:GetShardIterator"
23+
- "dynamodb:DescribeStream"
24+
- "dynamodb:ListStreams"
25+
Resource: "arn:aws:dynamodb:ap-southeast-1:*:table/${self:custom.dynamoDBTableName}/stream/*"
2426

2527
functions:
2628
backup:

aws-node-fetch-file-and-store-in-s3/serverless.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
service: fetch-file-and-store-in-s3
22

3-
frameworkVersion: ">=1.1.0"
3+
frameworkVersion: ">=2.24.0"
44

55
custom:
66
bucket: <your-bucket-name>
@@ -10,12 +10,14 @@ provider:
1010
runtime: nodejs12.x
1111
stage: dev
1212
region: us-west-1
13-
iamRoleStatements:
14-
- Effect: Allow
15-
Action:
16-
- s3:PutObject
17-
- s3:PutObjectAcl
18-
Resource: "arn:aws:s3:::${self:custom.bucket}/*"
13+
iam:
14+
role:
15+
statements:
16+
- Effect: Allow
17+
Action:
18+
- s3:PutObject
19+
- s3:PutObjectAcl
20+
Resource: "arn:aws:s3:::${self:custom.bucket}/*"
1921

2022
functions:
2123
save:

aws-node-graphql-and-rds/serverless.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ provider:
66
stage: dev
77
memorySize: 256
88
runtime: nodejs12.x
9-
role: LambdaRole
9+
iam:
10+
role: LambdaRole
1011
environment:
1112
#aurora
1213
AURORA_HOST: ${self:custom.AURORA.HOST}

aws-node-graphql-api-with-dynamodb/serverless.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ provider:
55
runtime: nodejs10.x
66
environment:
77
DYNAMODB_TABLE: ${self:service}-${self:provider.stage}
8-
iamRoleStatements:
9-
- Effect: Allow
10-
Action:
11-
- dynamodb:GetItem
12-
- dynamodb:UpdateItem
13-
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
8+
iam:
9+
role:
10+
statements:
11+
- Effect: Allow
12+
Action:
13+
- dynamodb:GetItem
14+
- dynamodb:UpdateItem
15+
Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.DYNAMODB_TABLE}"
1416

1517
functions:
1618
query:

aws-node-recursive-function/serverless.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ custom:
77
provider:
88
name: aws
99
runtime: nodejs12.x
10-
# iamRoleStatements:
11-
# - Effect: "Allow"
12-
# Action:
13-
# - "lambda:InvokeFunction"
14-
# Resource: ${self:custom.functionARN}
10+
# iam:
11+
# role:
12+
# statements:
13+
# - Effect: "Allow"
14+
# Action:
15+
# - "lambda:InvokeFunction"
16+
# Resource: ${self:custom.functionARN}
1517

1618
functions:
1719
recursiveExample:
18-
handler: handler.recursiveLambda
20+
handler: handler.recursiveLambda

aws-node-rekognition-analysis-s3-image/serverless.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ provider:
99
timeout: 10
1010
stage: dev
1111
region: us-east-1
12-
13-
iamRoleStatements:
14-
- Effect: Allow
15-
Action:
16-
- s3:*
17-
Resource: "*"
18-
- Effect: "Allow"
19-
Action:
20-
- "rekognition:*"
21-
Resource: "*"
12+
iam:
13+
role:
14+
statements:
15+
- Effect: Allow
16+
Action:
17+
- s3:*
18+
Resource: "*"
19+
- Effect: "Allow"
20+
Action:
21+
- "rekognition:*"
22+
Resource: "*"
2223

2324
functions:
2425
imageAnalysis:

0 commit comments

Comments
 (0)