-
Notifications
You must be signed in to change notification settings - Fork 4
/
instance-dns.yml
66 lines (52 loc) · 2.32 KB
/
instance-dns.yml
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
#cloud-config
# Dynamic DNS server for instances.
# Makes <instance-id>.instance.encodedcc.org and <name>.instance.encodedcc.org resolve.
# Run on a t2.micro instance with Ubuntu 14.04.
# Security group: ssh-dns.
# IAM role: demo-dns-server.
# $ aws ec2 run-instances --user-data file://instance-dns.yml --security-groups "ssh-dns" --iam-instance-profile Name="demo-dns-server" --image-id ami-5189a661 --instance-type t2.micro --region us-west-2
# Associate elastic-ip address for instance.encodedcc.org NS record.
# $ aws ec2 associate-address --public-ip 52.25.250.155 --region us-west-2 --instance-id i-xxxx
bootcmd:
- cloud-init-per once ssh-users-ca echo "TrustedUserCAKeys /etc/ssh/users_ca.pub" >> /etc/ssh/sshd_config
runcmd:
- set -e
- sudo -u ubuntu GOPATH=/home/ubuntu/gobuild go get github.com/ConradIrwin/aws-name-server
- cp /home/ubuntu/gobuild/bin/aws-name-server /usr/local/bin/
- setcap cap_net_bind_service=+ep /usr/local/bin/aws-name-server
- initctl start aws-name-server
output:
all: '| tee -a /var/log/cloud-init-output.log'
package_upgrade: true
packages:
- golang
- git
- ntp
- unattended-upgrades
- update-notifier-common
power_state:
mode: reboot
write_files:
- path: /etc/apt/apt.conf.d/20auto-upgrades
content: |
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
- path: /etc/apt/apt.conf.d/50unattended-upgrades
content: |
Unattended-Upgrade::Allowed-Origins {
"${distro_id} ${distro_codename}-security";
};
Unattended-Upgrade::Automatic-Reboot "true";
- path: /etc/init/aws-name-server.conf
content: |
# upstart script for aws-name-server
description "AWS Name Server"
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
setuid nobody
setgid nogroup
exec /usr/local/bin/aws-name-server --aws-region us-west-2 --domain instance.encodedcc.org
- path: /etc/ssh/users_ca.pub
content: ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAv/ymOcnN4LhM4NACc3Or116XXJ6KytuOgB/+1qNkOFBqBosrn7cmJ35rsoNHRgYNrCsRE9ch74RKsN6H72FtSJgBhGh/9oUK7Os6Fqt3/ZZXxgxIx6ubs/MTgrxrAnujiBxUXMXQhLKMriNMpo8mt4nGYVtLk9PBjiyfncaS8H9ZKoNio9dhP8bmTuYvioAI35dqKdSlVLyzr/XkZxia8Ki+pQ0N6uuiEwMR3ToM+LSp8wpFOOAiu4PEAujRW7us/+1hlpKWfn0J7/V3826joHE+I967Vg/+ikcVhF77JjK1nib879VgCWfmn1HPQosIpk4yJfVgGvRVI7I2nfBPVw== [email protected]