You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23Lines changed: 23 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -201,6 +201,29 @@ Shown below is a simple Node.js 16 function which has the appropriate [IAM Permi
201
201
202
202

203
203
204
+
#### Scope variables to a specific environment
205
+
Your `template.yaml` file can contain a variable that indicates the environment of the app. You can use this variable to fetch the correct env variable in SSM depending on the environment you are deploying your app to.
206
+
For exemple, a [Lamby app](https://lamby.cloud/docs/quick-start) has a `RailsEnv` variable in the `template.yaml` file that indicates the environment you are deploying the app:
207
+
```yaml
208
+
Parameters:
209
+
210
+
RailsEnv:
211
+
Type: String
212
+
Default: staging
213
+
AllowedValues:
214
+
- staging
215
+
- production
216
+
```
217
+
This variable can be used to get SSM variables that follow this path: `/myapp/${RailsEnv}/MY_VARIABLE`. The `template.yaml` file will then look like this:
This way you can have one different SSM variable for each one of your environments.
226
+
204
227
#### IAM Permissions
205
228
206
229
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).
0 commit comments