· 7 years ago · Jun 20, 2018, 08:30 PM
1{
2 "variables": {
3 "windows_admin_user": "Administrator",
4 "vpc": "vpc-17896871",
5 "subnet": "subnet-2ab73a62",
6 "aws_region": "eu-west-1",
7 "aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
8 "aws_secret_key": "{{env `AWS_SECRET_KEY`}}",
9 "aws_profile": "{{env `AWS_PROFILE`}}",
10 "ami_name": "windows-server-MyProfileName-pre--{{isotime \"02-Jan-06 03_04_05\"}}"
11 },
12 "builders": [{
13 "name": "AMI Windows Builder",
14 "type": "amazon-ebs",
15 "region": "{{user `aws_region`}}",
16 "access_key": "{{user `aws_access_key`}}",
17 "secret_key": "{{user `aws_secret_key`}}",
18 "profile": "{{ user `aws_profile`}}",
19 "source_ami_filter": {
20 "filters": {
21 "virtualization-type": "hvm",
22 "name": "Windows_Server-2012-R2_RTM-English-64Bit-Base-*",
23 "root-device-type": "ebs"
24 },
25 "owners": ["801119661308"],
26 "most_recent": true
27 },
28 "instance_type": "t2.micro",
29 "ami_name": "{{user `ami_name` | clean_ami_name}}",
30 "tags": {
31 "Name": "{{user `ami_name`}}"
32 },
33 "run_tags": {
34 "Name": "{{user `ami_name`}}"
35 },
36 "run_volume_tags": {
37 "Name": "{{user `ami_name`}}"
38 },
39 "snapshot_tags": {
40 "Name": "{{user `ami_name`}}"
41 },
42 "ami_description": "AWS Windows Server AMIs reloaded",
43 "associate_public_ip_address": "false",
44 "vpc_id": "{{user `vpc`}}",
45 "subnet_id": "{{user `subnet`}}",
46 "user_data_file": "scripts/bootstrapping.ps1",
47 "communicator": "winrm",
48 "winrm_username": "{{user `windows_admin_user`}}",
49 "winrm_timeout": "30m",
50 "winrm_port": 5986,
51 "winrm_use_ssl": true,
52 "winrm_insecure": true,
53 "ssh_interface": "private_ip",
54 "launch_block_device_mappings": [
55 {
56 "device_name": "/dev/sda1",
57 "volume_size": 100,
58 "volume_type": "gp2",
59 "delete_on_termination": true
60 }
61 ],
62 "ami_block_device_mappings": [
63 {
64 "device_name": "/dev/sdb",
65 "virtual_name": "ephemeral0"
66 }
67 ]
68 }],
69 "provisioners": [
70 {
71 "type": "powershell",
72 "scripts": [
73 "./scripts/EC2Config.ps1",
74 "./scripts/BundleConfig.ps1",
75 "./scripts/SetUpDevTools.ps1"
76 ]
77 },
78 {
79 "type": "windows-restart"
80 }
81 ]
82}