-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathpacker.json
More file actions
88 lines (88 loc) · 2.44 KB
/
packer.json
File metadata and controls
88 lines (88 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{
"variables": {
"aws_region": "",
"aws_vpc_id": "",
"aws_profile": "{{ env `AWS_PROFILE` }}",
"instance_type": "t2.micro",
"public_subnet_id": "",
"ami_name": "allcloud-amzn-ecs-{{isotime}}",
"xvda_volume_size": "8",
"xvdcz_volume_size": "22",
"encrypted": "false"
},
"builders": [
{
"type": "amazon-ebs",
"profile": "{{ user `aws_profile` }}",
"region": "{{ user `aws_region` }}",
"vpc_id": "{{ user `aws_vpc_id` }}",
"subnet_id": "{{ user `public_subnet_id` }}",
"associate_public_ip_address": "true",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "amzn-ami-*-amazon-ecs-optimized",
"root-device-type": "ebs"
},
"owners": [
"amazon"
],
"most_recent": true
},
"instance_type": "{{ user `instance_type` }}",
"ssh_username": "ec2-user",
"ami_name": "{{ user `ami_name` | clean_ami_name }}",
"ami_description": "AllCloud ECS optimized with SSM agent and AWS inspector and an encrypted volume",
"tags": {
"Name": "{{user `ami_name` | clean_ami_name }}"
},
"run_tags": {
"Name": "{{user `ami_name`}}"
},
"run_volume_tags": {
"Name": "{{user `ami_name`}}"
},
"snapshot_tags": {
"Name": "{{user `ami_name`}}"
},
"launch_block_device_mappings": [
{
"device_name": "/dev/xvda",
"volume_size": "{{ user `xvda_volume_size` }}",
"volume_type": "gp2",
"delete_on_termination": true
},
{
"device_name": "/dev/xvdcz",
"volume_size": "{{ user `xvdcz_volume_size` }}",
"volume_type": "gp2",
"encrypted": "{{user `encrypted`}}"
}
]
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"sudo yum update -y --security"
],
"expect_disconnect": true
},
{
"type": "shell",
"inline": [
"sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm",
"curl -s -L https://inspector-agent.amazonaws.com/linux/latest/install | sudo bash"
]
},
{
"type": "shell",
"inline": [
"rm .ssh/authorized_keys",
"sudo rm /root/.ssh/authorized_keys",
"sudo shred -u /etc/ssh/*_key /etc/ssh/*_key.pub"
]
}
]
}