Skip to content

Instantly share code, notes, and snippets.

@lorentzca
Created January 7, 2016 03:19
Show Gist options
  • Save lorentzca/f008151de5a8ffbd9ab0 to your computer and use it in GitHub Desktop.
Save lorentzca/f008151de5a8ffbd9ab0 to your computer and use it in GitHub Desktop.
create ami with packer
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}"
},
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "ap-northeast-1",
"source_ami": "ami-89634988",
"instance_type": "t2.micro",
"ssh_username": "centos",
"ssh_timeout": "10m",
"ssh_pty": true,
"ami_name": "my_ami {{timestamp}}"
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"sudo yum -y update"
]
}
]
}
@lorentzca
Copy link
Author

ami-89634988 : centos7 (official)

export access key 💥

export AWS_ACCESS_KEY_ID="XXXX"
export AWS_SECRET_ACCESS_KEY="YYYY"

build 🔨

$ packer build my_ami.json

⬇️ ⬇️ ⬇️

ss 2016-01-07 12 15 11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment