Skip to content

Commit 0870095

Browse files
authored
Update README.md
1 parent 51f52e8 commit 0870095

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,28 +201,29 @@ Shown below is a simple Node.js 16 function which has the appropriate [IAM Permi
201201

202202
![Screenshot of Code source in the AWS Lambda Console showing the `body` results of `1A2B3C4D5E6F` which is resolved from SSM Parameter Store.](/images/readme-code-results.png)
203203

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:
204+
#### Using Dynamic SSM Paths
205+
206+
Your `template.yaml` file can contain input `Parameters` that indicates the environment of the app. You can use this parameter to fetch the correct env variable in SSM depending on the environment you are deploying your app to. For exemple, a [Lamby app](https://lamby.cloud/docs/quick-start) has a `RailsEnv` parameter which is commonly set to to indicate the environment you running under:
207+
207208
```yaml
208209
Parameters:
209-
210210
RailsEnv:
211211
Type: String
212212
Default: staging
213213
AllowedValues:
214214
- staging
215215
- production
216216
```
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:
217+
218+
This parameter can be used to fetch SSM-backed environment variables that leveage dynamic paths like `/myapp/${RailsEnv}/MY_VARIABLE`. The `template.yaml` file will then look like this example below. This way you can have one different SSM variable for each one of your environments in a single AWS account.
219+
218220
```yaml
219221
Environment:
220222
Variables:
221223
SECRET: x-crypteia-ssm:/myapp/${RailsEnv}/SECRET
222224
ACCESS_KEY: x-crypteia-ssm:/myapp/${RailsEnv}/access-key
223225
X_CRYPTEIA_SSM: x-crypteia-ssm-path:/myapp/${RailsEnv}/envs
224226
```
225-
This way you can have one different SSM variable for each one of your environments.
226227

227228
#### IAM Permissions
228229

0 commit comments

Comments
 (0)