Axel Forstenhäusler (af096)
aws secretsmanager get-secret-value
--secret-id prod/google/api
--version-stage AWSCURRENT
{
"Name": "prod/google/api",
"VersionId": "dd5f7331-a99b-4417-9b42-f5c738e866f4",
"SecretString": "{\"googleApiKey\":\"asd897182kxakaksd\"}",
"VersionStages": [
"AWSCURRENT"
],
"CreatedDate": 1559729811.626,
"ARN": "arn:aws:secretsmanager:us-east-2:254943305144:secret:prod/google/api-lfCYH5"
}
Response:
var AWS = require('aws-sdk'),
region = "us-east-2",
secretName = "prod/google/api",
secret,
decodedBinarySecret;
// Create a Secrets Manager client
var client = new AWS.SecretsManager({
region: region
});
client.getSecretValue({SecretId: secretName}, function(err, data) {
if (err) {
throw err;
} else {
if ('SecretString' in data) {
secret = data.SecretString;
} else {
let buff = new Buffer(data.SecretBinary, 'base64');
decodedBinarySecret = buff.toString('ascii');
}
}
// Your code goes here.
});