To access parameter store in a different CDK region, follow the steps below:
Import the AWS SDK for the appropriate programming language you are using.
import * as AWS from 'aws-sdk';
Create an instance of the AWS SDK with the region you want to access.
const ssm = new AWS.SSM({ region: 'us-west-2' });
Use the getParameter
method to retrieve a specific parameter from the parameter store.
const response = await ssm.getParameter({ Name: 'my-parameter' }).promise();
const parameterValue = response.Parameter?.Value;
Optionally, you can also use the putParameter
method to store a parameter in the parameter store.
await ssm.putParameter({ Name: 'my-parameter', Value: 'my-value', Type: 'String' }).promise();
Note: It is important to ensure that your IAM role has the appropriate permissions to access the parameter store in the region you want to access.
Asked: 2021-04-23 11:00:00 +0000
Seen: 14 times
Last updated: Dec 12 '22