$ aws cloudformation get-template-summary --template-body file://template.yml > /path/to/summary.json
$ node index.js < /path/to/summary.json > /path/to/resources.jsonFill in the missing values in your the output file and import it.
| /** | |
| * Ensures a list of promises run in series | |
| * @param {array} funcs - an array of funcs that return promises | |
| * @returns {object} | |
| */ | |
| const series = (funcs) => funcs.reduce((p, f) => p.then(f), Promise.resolve()); |
| // Thanks go to some random, but forgotten, SE page. | |
| const sane = JSON.stringify("Emdashses should be banned. –") | |
| .replace( | |
| /[^\x20-\x7F]/g, | |
| x => "\\u" + ("000" + x.codePointAt(0).toString(16)).slice(-4) | |
| ); | |
| console.log(sane); | |
| // Emdashses should be banned. \u2013 |
| const sane = JSON.stringify("Emdashses should be banned. –") | |
| .replace( | |
| /[^\x20-\x7F]/g, | |
| x => "\\u" + ("000" + x.codePointAt(0).toString(16)).slice(-4) | |
| ); | |
| console.log(sane); | |
| // Emdashses should be banned. \u2013 |
| #!/bin/env bash | |
| # Cribbed from somewhere on the internet | |
| for user in $(aws iam list-users --output text | awk '{print $NF}'); do | |
| aws iam list-access-keys --user $user --output text | |
| done |
| sudo mkdir /usr/local/n | |
| sudo chown -R `whoami`:admin /usr/local/n | |
| sudo chown -R `whoami`:admin /usr/local/include/node | |
| sudo chown -R `whoami`:admin /usr/local/bin | |
| sudo chown -R `whoami`:admin /usr/local/share | |
| sudo chown -R `whoami`:admin /usr/local/lib | |
| # sudo chown -R `whoami`:admin /usr/local/lib/dtrace |
| --- | |
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: 'CloudFormation exports' | |
| Conditions: | |
| HasNot: !Equals [ 'true', 'false' ] | |
| # dummy (null) resource, never created | |
| Resources: | |
| NullResource: |
| # Cribbed from https://serverfault.com/questions/84815/how-can-i-get-the-size-of-an-amazon-s3-bucket | |
| aws s3api list-objects --bucket ${BUCKET} --output json --query "[sum(Contents[].Size), length(Contents[])]" |
Add the policy.json to the source bucket. Ensure the profile being used has s3:PutObject, s3:GetObject and s3:PutObjectAcl (AWS docs).
Execute:
$ aws s3 sync \
s3://source \
s3://target \