Skip to content

Commit bfa8a77

Browse files
committed
[ci skip] Update IAM Permissions Docs
1 parent d2b5fa2 commit bfa8a77

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

README.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -191,32 +191,36 @@ Shown below is a simple Node.js 16 function which has the appropriate [IAM Permi
191191

192192
#### IAM Permissions
193193

194-
Please refer to the AWS guide on [Restricting access to Systems Manager parameters using IAM policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-access.html) for details on which policies your function's IAM Role will need. For an appliction to pull both single parameters as well as bulk paths, I have found the following policy helpful; it assumes the `/myapp` prefix and uses the AWS default KMS encryption key:
194+
Please refer to the AWS guide on [Restricting access to Systems Manager parameters using IAM policies](https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-paramstore-access.html) for details on which policies your function's IAM Role will need. These examples assume the `/myapp` prefix and should work for direct secrets in that path or further nesting in a path prefix as described in the [usage section](#usage).
195195

196196
```json
197197
{
198198
"Version": "2012-10-17",
199199
"Statement": [
200200
{
201-
"Action": [
202-
"ssm:GetParameter",
203-
"ssm:GetParametersByPath",
204-
"ssm:GetParameters",
205-
"ssm:GetParameterHistory",
206-
"ssm:DescribeParameters"
207-
],
208-
"Resource": "arn:aws:ssm:us-east-1:123456789012:parameter/myapp*",
209-
"Effect": "Allow"
210-
},
211-
{
212-
"Action": "kms:Decrypt",
213-
"Resource": "arn:aws:kms:us-east-1:123456789012:key/4914ec06-e888-4ea5-a371-5b88eEXAMPLE",
214-
"Effect": "Allow"
201+
"Effect": "Allow",
202+
"Action": ["ssm:Get*", "ssm:Describe*"],
203+
"Resource": "arn:aws:ssm:*:${AWS::AccountId}:parameter/myapp/*"
215204
}
216205
]
217206
}
218207
```
219208

209+
Here is an example [Policies](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-policies) section you could add to your AWS SAM `template.yaml` file.
210+
211+
```yaml
212+
Policies:
213+
- Statement:
214+
- Effect: Allow
215+
Action: ["ssm:Get*", "ssm:Describe*"]
216+
Resource:
217+
- !Sub arn:aws:ssm:*:${AWS::AccountId}:parameter/myapp/*
218+
```
219+
220+
> **Note**
221+
> If you are not using default encryption key, you will also need to add a [KMSDecryptPolicy](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-policy-template-list.html#kms-decrypt-policy) policy.
222+
223+
220224
#### Troubleshooting
221225

222226
Crypteia has very verbose logging which is enabled via the `CRYPTEIA_DEBUG` environment variable:

0 commit comments

Comments
 (0)