· 9 years ago · Jan 20, 2017, 12:26 PM
1{
2 "variables": {
3 "aws_access_key": "",
4 "aws_secret_key": "",
5 "aws_account_id": "",
6 "aws_region": ""
7 },
8 "builders": [
9 {
10 "type": "amazon-ebs",
11 "region": "{{user `aws_region`}}",
12 "access_key": "{{user `aws_access_key`}}",
13 "secret_key": "{{user `aws_secret_key`}}",
14 "source_ami": "ami-29f96d3e",
15 "instance_type": "t2.small",
16 "ssh_username": "ubuntu",
17 "encrypt_boot": true,
18 "ami_name": "docker-{{timestamp}}",
19 "ami_description": "A Ubuntu 16.04 LTS based Docker AMI.",
20 "tags": {
21 "os": "ubuntu-16-04",
22 "docker-release": "opensource",
23 "docker-branch": "stable"
24 },
25 "launch_block_device_mappings": [
26 {
27 "device_name": "/dev/sda1",
28 "volume_size": 50,
29 "volume_type": "gp2",
30 "delete_on_termination": "true"
31 },
32 {
33 "device_name": "/dev/xvdb",
34 "volume_size": 100,
35 "volume_type": "gp2",
36 "delete_on_termination": "true",
37 "encrypted": "true"
38 }
39 ],
40 "ami_block_device_mappings": [
41 {
42 "device_name": "/dev/sda1",
43 "volume_size": 50,
44 "volume_type": "gp2",
45 "delete_on_termination": "true"
46 },
47 {
48 "device_name": "/dev/xvdb",
49 "volume_size": 100,
50 "volume_type": "gp2",
51 "delete_on_termination": "true",
52 "encrypted": "true"
53 }
54 ]
55 }
56 ],
57
58 "provisioners": [
59 {
60 "type": "shell",
61 "script": "setup.sh",
62 "environment_vars": [
63 "AWS_REGION={{user `aws_region`}}"
64 ],
65 "execute_command": "{{ .Vars }} sudo -E -S bash '{{ .Path }}'"
66 }
67 ]
68}