Skip to content

Instantly share code, notes, and snippets.

@willglynn
Created July 28, 2016 17:20
Show Gist options
  • Save willglynn/3395441349765803a5b28657a782c719 to your computer and use it in GitHub Desktop.
Save willglynn/3395441349765803a5b28657a782c719 to your computer and use it in GitHub Desktop.
ec2-bundle-and-upload-image example
$ wget -q http://stable.release.core-os.net/amd64-usr/1068.8.0/coreos_production_ami_image.bin.bz2
$ ec2-bundle-and-upload-image -image coreos_production_ami_image.bin.bz2 -s3-bucket totally-not-official-ami -s3-prefix ec2-bundle-and-upload-image/ -name "CoreOS-stable-1068.8.0"
2016/07/28 12:08:19 Using "-region us-east-1" to match S3 bucket
2016/07/28 12:08:19 Using "-account 123456789012" based on active credentials
2016/07/28 12:08:19 Determining size of compressed image...
2016/07/28 12:09:18 Compressed image is 4756340736 bytes
2016/07/28 12:09:18 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.0
2016/07/28 12:09:23 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.1
2016/07/28 12:09:28 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.2
2016/07/28 12:09:31 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.3
2016/07/28 12:09:36 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.4
2016/07/28 12:09:41 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.5
2016/07/28 12:09:46 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.6
2016/07/28 12:09:50 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.7
2016/07/28 12:09:56 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.8
2016/07/28 12:10:00 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.9
2016/07/28 12:10:06 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.10
2016/07/28 12:10:11 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.11
2016/07/28 12:10:15 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.12
2016/07/28 12:10:19 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.13
2016/07/28 12:10:23 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.14
2016/07/28 12:10:28 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.15
2016/07/28 12:10:33 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.16
2016/07/28 12:10:37 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.17
2016/07/28 12:10:42 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.18
2016/07/28 12:10:47 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.19
2016/07/28 12:10:51 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.20
2016/07/28 12:10:55 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.21
2016/07/28 12:10:59 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.22
2016/07/28 12:11:05 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.23
2016/07/28 12:11:10 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.24
2016/07/28 12:11:16 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.25
2016/07/28 12:11:20 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.26
2016/07/28 12:11:25 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.27
2016/07/28 12:11:41 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.part.28
2016/07/28 12:11:59 Writing to s3://totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.manifest.xml
2016/07/28 12:12:00 Bundle creation/upload complete.
2016/07/28 12:12:00 Register your new AMI using e.g.:
2016/07/28 12:12:00 `aws ec2 register-image --name "coreos_production_ami_image.bin.bz2" --virtualization-type=hvm --block-device-mappings "VirtualName=ami,DeviceName=sda VirtualName=ephemeral0,DeviceName=sdb" --root-device=/dev/xvda --image-location totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.manifest.xml`
2016/07/28 12:12:00 Printing image location to standard output and terminating
totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.manifest.xml
$ aws ec2 register-image --name "CoreOS-stable-1068.8.0-is-hvm-simple" --description "CoreOS stable 1068.8.0 instance store HVM, built by ec2-bundle-and-upload-image" --virtualization-type=hvm --block-device-mappings "VirtualName=ami,DeviceName=sda VirtualName=ephemeral0,DeviceName=sdb" --root-device=/dev/xvda --image-location totally-not-official-ami/ec2-bundle-and-upload-image/CoreOS-stable-1068.8.0.manifest.xml
{
"ImageId": "ami-5b33a74c"
}
$ ami=ami-5b33a74c
$ instance=$(aws ec2 run-instances --key-name … --security-group-ids sg-… --instance-type m3.large --associate-public-ip-address --subnet-id … --image-id $ami --query 'Instances[0].InstanceId' --output text); echo $instance
i-f6c7d270
$ ssh core@$(aws ec2 describe-instances --instance-id $instance --query 'Reservations[0].Instances[0].PublicDnsName' --output text)
Warning: Permanently added 'ec2-54-210-23-227.compute-1.amazonaws.com,54.210.23.227' (ECDSA) to the list of known hosts.
CoreOS stable (1068.8.0)
Last login: Thu Jul 28 17:16:17 2016 from …
core@ip-172-30-20-254 ~ $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment