Last active
September 27, 2019 17:47
-
-
Save justengland/cf45770a019bc4f2abd01f2426e808ee to your computer and use it in GitHub Desktop.
Copy SSM Paramertes from account to account.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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