Skip to content

Instantly share code, notes, and snippets.

@justengland
Last active September 27, 2019 17:47
Show Gist options
  • Save justengland/cf45770a019bc4f2abd01f2426e808ee to your computer and use it in GitHub Desktop.
Save justengland/cf45770a019bc4f2abd01f2426e808ee to your computer and use it in GitHub Desktop.
Copy SSM Paramertes from account to account.
var out = require('./out.json').Parameters
var eachLimit = require('async').eachLimit
var AWS = require("aws-sdk");
var ssm = new AWS.SSM();
// Copy parameters locally
// aws ssm get-parameters-by-path --path /your/path/ --recursive --with-decryption > out.json
eachLimit(out, 2, function({Name, Value, Type}, callback) {
console.log('parm:', Name)
var params = {Name, Value, Type, Overwrite: true}
ssm.putParameter(params, function(err, data) {
if (err) console.log("Error Loading: ", Name, err, err.stack); // an error occurred
else console.log('Loaded: ', Name)
callback()
});
}, function(err) {
// if any of the file processing produced an error, err would equal that error
if( err ) {
// One of the iterations produced an error.
// All processing will now stop.
console.log('A file failed to process');
} else {
console.log('All files have been processed successfully');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment