Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Amplify doc to add sdk v3 code #7674

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ To access the secret values in your Lambda function, use the [AWS SSM GetParamet

If your Lambda function is using the Node.js runtime, a comment block will be placed at the top of your `index.js` file with example code to retrieve the secret values.

<BlockSwitcher>

<Block name='AWS SDK V2'>

```js
const aws = require('aws-sdk');

Expand All @@ -89,6 +93,25 @@ const { Parameters } = await (new aws.SSM())

// Parameters will be of the form { Name: 'secretName', Value: 'secretValue', ... }[]
```
</Block>

<Block name='AWS SDK V3'>

```js
const {ssm} = require("@aws-sdk/client-ssm");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const { Parameters } = await (new ssm())
.getParameters({
Names: ["EXAMPLE_SECRET_1", "EXAMPLE_SECRET_2"].map(secretName => process.env[secretName]),
WithDecryption: true,
})
.promise();

// Parameters will be of the form { Name: 'secretName', Value: 'secretValue', ... }[]
```
</Block>

</BlockSwitcher>

## Multi-environment flows
When creating a new Amplify environment using `amplify env add`, Amplify CLI asks if you want to apply all secret values to the new environment or modify them. If you choose to apply the existing values, you can still make edits anytime using `amplify update function`.
Expand Down
Loading