├── .gitignore ├── main.go ├── LICENSE.txt └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | packer-builder-amazon-scratch 2 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/mitchellh/packer/packer/plugin" 5 | "github.com/sorah/packer-builder-amazon-scratch/builder/amazon/scratch" 6 | ) 7 | 8 | func main() { 9 | server, err := plugin.Server() 10 | if err != nil { 11 | panic(err) 12 | } 13 | server.RegisterBuilder(new(scratch.Builder)) 14 | server.Serve() 15 | } 16 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Shota Fukumori (sora_h) 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # packer-builder-amazon-scratch 2 | 3 | ## What's this? 4 | 5 | Packer builder plugin that allows to AMI from empty volume. 6 | 7 | ``` json 8 | { 9 | "type": "amazon-scratch", 10 | "region": "ap-northeast-1", 11 | "source_ami": "ami-936d9d93", 12 | "subnet_id": "subnet-XXX", 13 | "associate_public_ip_address": true, 14 | "instance_type": "t2.micro", 15 | "ssh_username": "ubuntu", 16 | "ami_name": "packer {{timestamp}}", 17 | "worker_device_name": "/dev/sdf", 18 | "volume_size": 4, 19 | "volume_type": "gp2" 20 | } 21 | ``` 22 | 23 | this will starts instance with 4GB gp2 EBS, using `ami-936d9d93`. Then provision your stuff on `/dev/sdf`. 24 | 25 | Finally `/dev/sdf` will be used as root block device on new AMI. 26 | 27 | ## Difference with `amazon-chroot` 28 | 29 | - amazon-chroot doesn't allow do something on host machine -- it runs all commands in chrooted environment. 30 | - amazon-chroot requires run `packer` on an existing EC2 instance, but this doesn't. 31 | - this launches `source_ami` to create AMI, each time. 32 | - this creates _empty_ EBS. amazon-chroot always requires source AMI as base. 33 | 34 | ## Author 35 | 36 | sorah 37 | 38 | ## License 39 | 40 | MIT License 41 | --------------------------------------------------------------------------------