Skip to content

Commit fb0142e

Browse files
authored
Merge pull request #204 from am29d/docs/add-iam-permissions-for-layer
docs: add minimal permission set for using layer
2 parents f7a6794 + 5dd28f0 commit fb0142e

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

Diff for: docs/content/index.mdx

+41
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,47 @@ This will add a nested app stack with an output parameter `LayerVersionArn`, tha
5151
- !GetAtt AwsLambdaPowertoolsPythonLayer.Outputs.LayerVersionArn
5252
```
5353

54+
Here is the list of IAM permissions that you need to add to your deployment IAM role to use the layer:
55+
56+
```yaml
57+
Version: '2012-10-17'
58+
Statement:
59+
- Sid: CloudFormationTransform
60+
Effect: Allow
61+
Action: cloudformation:CreateChangeSet
62+
Resource:
63+
- arn:aws:cloudformation:us-east-1:aws:transform/Serverless-2016-10-31
64+
- Sid: GetCfnTemplate
65+
Effect: Allow
66+
Action:
67+
- serverlessrepo:CreateCloudFormationTemplate
68+
- serverlessrepo:GetCloudFormationTemplate
69+
Resource:
70+
# this is arn of the powertools SAR app
71+
- arn:aws:serverlessrepo:eu-west-1:057560766410:applications/aws-lambda-powertools-python-layer
72+
- Sid: S3AccessLayer
73+
Effect: Allow
74+
Action:
75+
- s3:GetObject
76+
Resource:
77+
# AWS publishes to an external S3 bucket locked down to your account ID
78+
# The below example is us publishing lambda powertools
79+
# Bucket: awsserverlessrepo-changesets-plntc6bfnfj
80+
# Key: *****/arn:aws:serverlessrepo:eu-west-1:057560766410:applications-aws-lambda-powertools-python-layer-versions-1.6.0/aeeccf50-****-****-****-*********
81+
- arn:aws:s3:::awsserverlessrepo-changesets-*/*
82+
- Sid: GetLayerVersion
83+
Effect: Allow
84+
Action:
85+
- lambda:PublishLayerVersion
86+
- lambda:GetLayerVersion
87+
Resource:
88+
- !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccoundId}:layer:aws-lambda-powertools-python-layer*
89+
```
90+
91+
> Credits to [mwarkentin](https://github.com/mwarkentin) for providing the scoped down IAM permissions.
92+
93+
The region and the account id for `CloudFormationTransform` and `GetCfnTemplat` are fixed.
94+
5495
You can fetch the available versions via the API with:
5596

5697
```bash

0 commit comments

Comments
 (0)