Skip to content

Instantly share code, notes, and snippets.

@asakura
Last active August 29, 2015 14:10
Show Gist options
  • Save asakura/050febf9f97ca4e53f38 to your computer and use it in GitHub Desktop.
Save asakura/050febf9f97ca4e53f38 to your computer and use it in GitHub Desktop.
Seed example for cloud-init version > 0.7
$ mkdir seed
$ cd seed
# create user-data and meta-data files that will be used to modify image on first boot
# feel free to change `instance-id' and `local-hostname'
$ { echo instance-id: iid-local01; echo local-hostname: cloudimg; } > meta-data
# customize that with your user info
$ cat << EOF > user-data
#cloud-config
manage_etc_hosts: localhost
users:
- name: asakura
groups:
- sudo
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCcKhUGgzZTycTHQPjfd12MeSaFYl2pomE0pvzJuQVBJHAdMg0mTLphtAA7jUVp1mMaLXhONVZMTqyy9Jkb0lhZK6wzDC+MwyqB543Q/umHpRccULOWfjvB0S33ZA6414287kshqbH4tfkQ5+2lJitj2FDUIck9BPwUBSvOeyDsOuU6PeCY8qD2czvKk2QN96h2SngibuQ+ty7nLdqIGedAojevKk9YwtopTRey3Xxe4g++Ew4Jc40jH9oY0KHVS0vIVeKkpJow7W4xmS5zviMfdejjhmirDErpYP6DqIJwl0wlBn/D/ghoWgYfUzuBjUBQ+sHZRQ+mgUW3ZTaHdzBgwVLKuzckCovdq6fA3wL+x3rexR1avhR/AxnMmc4hFc5/TGhqTs9oRKRwo7A6wrufn7SKtrbbtoAB6tfwT+upUxqwTpuZVitLTbuUSafeKUSt09p/H0kvutwpenypBHunFpa1i+Z/pd/MJ+FIedJqpojFfFmYIyHktwO3rIigJnzdmuQF+oo3c/9Xuz8+vazfFVCTLEAzIkokIqJop04o4GCiZzFHZTj5p85vxnfZMgBiHnZ5ox6h6mpzwomJPJWf4cSokh3bLuB7lUVWbLlv7/HklEKSZpBAKN0v7qogEshCCLGH9UX8HkpWJcM81ikXri2dUCsxz3dcXJ54q1glfw== [email protected]
EOF
# create a disk to attach with some user-data and meta-data
$ genisoimage -output seed.iso -volid cidata -joliet -rock user-data meta-data
# mount seed.iso to virtual machine and boot instance,
# and then try to ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment