Skip to content

Instantly share code, notes, and snippets.

@solidsnack
Last active May 27, 2016 23:36
Show Gist options
  • Save solidsnack/79e3eaa072825c5c2e8cabfbe5e2851d to your computer and use it in GitHub Desktop.
Save solidsnack/79e3eaa072825c5c2e8cabfbe5e2851d to your computer and use it in GitHub Desktop.
CFN region mapping for Ubuntu 16.04 LTS AMI
{
"AWSRegionArch2AMI": {
"ap-northeast-1": {
"amd64XhvmXebsXssd": "ami-5d38d93c",
"amd64XhvmXephemeral": "ami-0b31d06a",
"amd64XebsXssd": "ami-f537d694",
"amd64Xephemeral": "ami-0522c364"
},
"ap-southeast-1": {
"amd64XhvmXebsXssd": "ami-a35284c0",
"amd64XhvmXephemeral": "ami-53518730",
"amd64XebsXssd": "ami-55518736",
"amd64Xephemeral": "ami-0855836b"
},
"eu-central-1": {
"amd64XhvmXebsXssd": "ami-f9e30f96",
"amd64XhvmXephemeral": "ami-b4e10ddb",
"amd64XebsXssd": "ami-2ce20e43",
"amd64Xephemeral": "ami-3be50954"
},
"eu-west-1": {
"amd64XhvmXebsXssd": "ami-7a138709",
"amd64XhvmXephemeral": "ami-a11581d2",
"amd64XebsXssd": "ami-2f10845c",
"amd64Xephemeral": "ami-f26df981"
},
"sa-east-1": {
"amd64XhvmXebsXssd": "ami-0d5dd561",
"amd64XhvmXephemeral": "ami-0250d86e",
"amd64XebsXssd": "ami-6c5dd500",
"amd64Xephemeral": "ami-2053db4c"
},
"us-east-1": {
"amd64XhvmXebsXssd": "ami-13be557e",
"amd64XhvmXephemeral": "ami-20a64d4d",
"amd64XebsXssd": "ami-bcb853d1",
"amd64Xephemeral": "ami-e8ae4585"
},
"us-west-1": {
"amd64XhvmXebsXssd": "ami-84423ae4",
"amd64XhvmXephemeral": "ami-95433bf5",
"amd64XebsXssd": "ami-2e433b4e",
"amd64Xephemeral": "ami-df423abf"
},
"us-gov-west-1": {
"amd64XhvmXebsXssd": "ami-8f4df2ee",
"amd64XhvmXephemeral": "ami-cc4df2ad",
"amd64XebsXssd": "ami-0849f669",
"amd64Xephemeral": "ami-ac4af5cd"
},
"ap-southeast-2": {
"amd64XhvmXebsXssd": "ami-f4361997",
"amd64XhvmXephemeral": "ami-ff341b9c",
"amd64XebsXssd": "ami-2b321d48",
"amd64Xephemeral": "ami-66361905"
},
"us-west-2": {
"amd64XhvmXebsXssd": "ami-06b94666",
"amd64XhvmXephemeral": "ami-9dbb44fd",
"amd64XebsXssd": "ami-1cb6497c",
"amd64Xephemeral": "ami-dc43bfbc"
}
}
}
/* Visit http://cloud-images.ubuntu.com/locator/ec2/
*
* Paste script into console.
*
* A mapping suitable for use in cloud formation templates will be in the
* clipboard.
*/
var inverted = {};
var data = [];
var rows = document.querySelectorAll('#ami tbody tr');
for (var i = 0; i < rows.length; i++) {
var row = rows[i];
data.push({
'ami': row.querySelector('td:nth-child(7)').innerText,
'region': row.querySelector('td:nth-child(1)').innerText,
'arch': row.querySelector('td:nth-child(4)').innerText,
'variety': row.querySelector('td:nth-child(5)').innerText
});
}
for (var i = 0; i < data.length; i++) {
var o = data[i];
inverted[o.region] = inverted[o.region] || {};
// The name must be sanitized because of restrictions on names in
// CloudFormation mapping files.
var name = (o.arch + '/' + o.variety).replace('instance-store', 'ephemeral')
.replace(/[-:/]/g, 'X');
inverted[o.region][name] = o.ami;
}
copy(JSON.stringify({'AWSRegionArch2AMI': inverted}, undefined, 2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment