I have a lambda in AWS Account 1.
I have an SSM parameter in AWS Account 2.
I want to write code in the lambda like this:
const ssm = new AWS.SSM({apiVersion: "2014-11-06"});
function updateSsmParamInOtherAwsAccount(newSsmValue) {
const params = {
Name: "ssm-parameter-name",
Value: newSsmValue,
Overwrite: true,
Type: "String",
};
ssm.putParameter(params, function (err) {
if (err) {
console.error(
err,
err.stack
);
} else {
console.log(
`Successfully set SSM param`
);
}
});
}
I understand how to use IAM to grant permissions for this.
What I don't understand is how to configure the aws javascript sdk to point to the other AWS account.
As written in the example above, it will update the SSM param in the same AWS account the lambda is running in. There don't seem to be any environment variables or configuration options that allow this.
Anyone know how to connect the dots here?