@@ -143,10 +143,6 @@ Parameters:
143
143
- Intel/AMD (x86_64)
144
144
- Graviton (arm64)
145
145
Default : Graviton (arm64)
146
- instanceType :
147
- Type : String
148
- Description : " https://console.aws.amazon.com/ec2/#InstanceTypes"
149
- Default : t4g.xlarge
150
146
151
147
ec2Name :
152
148
Type : String
@@ -157,6 +153,10 @@ Parameters:
157
153
Description : " https://console.aws.amazon.com/ec2/#KeyPairs"
158
154
ConstraintDescription : Specify a key pair
159
155
AllowedPattern : " .+"
156
+ instanceType :
157
+ Type : String
158
+ Description : " https://console.aws.amazon.com/ec2/#InstanceTypes"
159
+ Default : t4g.xlarge
160
160
ec2TerminationProtection :
161
161
Type : String
162
162
Description : " https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_ChangingDisableAPITermination.html"
@@ -264,9 +264,9 @@ Parameters:
264
264
Type : String
265
265
Description : https://aws.amazon.com/ebs/general-purpose/
266
266
AllowedValues :
267
- - " gp3"
268
- - " gp2"
269
- Default : " gp3"
267
+ - gp3
268
+ - gp2
269
+ Default : gp3
270
270
271
271
enableBackup :
272
272
Type : String
@@ -1254,33 +1254,6 @@ Resources:
1254
1254
mode : " 000755"
1255
1255
owner : " ec2-user"
1256
1256
group : " ec2-user"
1257
- " /usr/lib/systemd/system/certbot-renew.timer " :
1258
- content : |
1259
- [Unit]
1260
- Description=This is the timer to set the schedule for automated renewals
1261
-
1262
- [Timer]
1263
- OnCalendar=*-*-* 00/12:00:00
1264
- RandomizedDelaySec=12hours
1265
- Persistent=true
1266
-
1267
- [Install]
1268
- WantedBy=timers.target
1269
- mode : " 000644"
1270
- owner : " root"
1271
- group : " root"
1272
- " /usr/lib/systemd/system/certbot-renew.service " :
1273
- content : |
1274
- [Unit]
1275
- Description=This service automatically renews any certbot certificates found
1276
-
1277
- [Service]
1278
- EnvironmentFile=/etc/sysconfig/certbot
1279
- Type=oneshot
1280
- ExecStart=/usr/bin/certbot renew --noninteractive --no-random-sleep-on-renew $PRE_HOOK $POST_HOOK $RENEW_HOOK $DEPLOY_HOOK $CERTBOT_ARGS
1281
- mode : " 000644"
1282
- owner : " root"
1283
- group : " root"
1284
1257
" /etc/systemd/system/dcv-virtual-session.service " :
1285
1258
content : |
1286
1259
[Unit]
@@ -1304,20 +1277,14 @@ Resources:
1304
1277
for dcvUser in "${dcvUsers[@]}"
1305
1278
do
1306
1279
if (! /usr/bin/dcv list-sessions | grep -q $dcvUser); then
1307
- case $dcvUser in
1308
- root)
1309
- /usr/bin/dcv create-session $dcvUser --owner root --storage-root /root
1310
- ;;
1311
- *)
1312
- /usr/bin/dcv create-session $dcvUser --owner $dcvUser --user $dcvUser --storage-root /home/$dcvUser
1313
- ;;
1314
- esac
1280
+ /usr/bin/dcv create-session $dcvUser --owner $dcvUser --storage-root %home% --type virtual
1315
1281
fi
1316
1282
done
1283
+ date
1317
1284
/usr/bin/dcv list-sessions
1318
1285
sleep 5
1319
1286
done
1320
- mode : " 000755 "
1287
+ mode : " 000744 "
1321
1288
owner : " root"
1322
1289
group : " root"
1323
1290
" /etc/systemd/system/dcv-post-reboot.service " :
@@ -1404,15 +1371,6 @@ Resources:
1404
1371
yum clean all
1405
1372
yum update -q -y
1406
1373
1407
- # remove AWSCLI version 1
1408
- yum remove -q -y awscli
1409
- cd /tmp/cfn
1410
- # AWS CLI v2: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
1411
- curl -s https://awscli.amazonaws.com/awscli-exe-linux-$(arch).zip -o awscliv2.zip
1412
- unzip -q -o awscliv2.zip
1413
- ./aws/install -b /usr/bin
1414
- echo "export AWS_CLI_AUTO_PROMPT=on-partial" >> /home/ec2-user/.bashrc
1415
-
1416
1374
# yum-cron
1417
1375
yum install -q -y yum-cron
1418
1376
sed -i 's/apply_updates = no/apply_updates = yes/g' /etc/yum/yum-cron.conf
@@ -1454,10 +1412,63 @@ Resources:
1454
1412
usermod -aG docker ec2-user
1455
1413
fi
1456
1414
1415
+ # AWS CLI: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
1416
+ yum remove -q -y awscli
1417
+ cd /tmp/cfn
1418
+ # AWS CLI v2: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
1419
+ curl -s https://awscli.amazonaws.com/awscli-exe-linux-$(arch).zip -o awscliv2.zip
1420
+ unzip -q -o awscliv2.zip
1421
+ ./aws/install -b /usr/bin
1422
+ echo "export AWS_CLI_AUTO_PROMPT=on-partial" >> /home/ec2-user/.bashrc
1423
+
1424
+ # Certbot: https://certbot.eff.org/instructions?ws=other&os=pip
1425
+ yum install -q -y augeas-libs
1426
+ amazon-linux-extras install -q -y python3.8
1427
+
1428
+ /usr/bin/python3.8 -m venv /opt/certbot/
1429
+ /opt/certbot/bin/pip install --upgrade pip
1430
+ /opt/certbot/bin/pip install certbot
1431
+ /opt/certbot/bin/pip install certbot-dns-route53
1432
+ /opt/certbot/bin/pip install certbot-apache
1433
+ /opt/certbot/bin/pip install certbot-nginx
1434
+ ln -s /opt/certbot/bin/certbot /usr/bin/certbot
1435
+
1436
+ touch /etc/sysconfig/certbot
1437
+ chmod og-rwx /etc/sysconfig/certbot
1438
+ systemctl daemon-reload
1439
+ systemctl enable --now certbot-renew.timer
1440
+
1457
1441
rm -f ${!0}
1458
1442
mode : " 000740"
1459
1443
owner : " root"
1460
1444
group : " root"
1445
+ " /usr/lib/systemd/system/certbot-renew.timer " :
1446
+ content : |
1447
+ [Unit]
1448
+ Description=This is the timer to set the schedule for automated renewals
1449
+
1450
+ [Timer]
1451
+ OnCalendar=*-*-* 00/12:00:00
1452
+ RandomizedDelaySec=12hours
1453
+ Persistent=true
1454
+
1455
+ [Install]
1456
+ WantedBy=timers.target
1457
+ mode : " 000640"
1458
+ owner : " root"
1459
+ group : " root"
1460
+ " /usr/lib/systemd/system/certbot-renew.service " :
1461
+ content : |
1462
+ [Unit]
1463
+ Description=This service automatically renews any certbot certificates found
1464
+
1465
+ [Service]
1466
+ EnvironmentFile=/etc/sysconfig/certbot
1467
+ Type=oneshot
1468
+ ExecStart=/usr/bin/certbot renew --noninteractive --no-random-sleep-on-renew $PRE_HOOK $POST_HOOK $RENEW_HOOK $DEPLOY_HOOK $CERTBOT_ARGS
1469
+ mode : " 000640"
1470
+ owner : " root"
1471
+ group : " root"
1461
1472
commands :
1462
1473
install :
1463
1474
command : " /root/install-sw.sh >> /var/log/install-sw.log 2>&1"
@@ -1470,6 +1481,9 @@ Resources:
1470
1481
mkdir -p /tmp/cfn
1471
1482
cd /tmp/cfn
1472
1483
1484
+ # Update OS
1485
+ yum update -q -y
1486
+
1473
1487
# DCV prereq: https://docs.aws.amazon.com/dcv/latest/adminguide/setting-up-installing-linux-prereq.html
1474
1488
yum install -q -y gdm gnome-session gnome-classic-session gnome-session-xsession
1475
1489
yum install -q -y xorg-x11-server-Xorg xorg-x11-fonts-Type1 xorg-x11-drivers
@@ -1701,27 +1715,10 @@ Resources:
1701
1715
amazon-linux-extras install -y redis6 memcached1.5
1702
1716
systemctl enable --now redis memcached
1703
1717
1704
- # Certbot: https://certbot.eff.org/instructions?ws=other&os=pip
1705
- yum install -q -y augeas-libs
1706
- amazon-linux-extras install -y python3.8
1707
- /usr/bin/python3.8 -m venv /opt/certbot/
1708
- /opt/certbot/bin/pip install --upgrade pip
1709
- /opt/certbot/bin/pip install certbot
1710
- /opt/certbot/bin/pip install certbot-dns-route53
1711
- ln -s /opt/certbot/bin/certbot /usr/bin/certbot
1712
-
1713
- # Certbot update script
1714
- # https://certbot.org/renewal-setup: use systemd timer
1715
- touch /etc/sysconfig/certbot
1716
- chmod og-rwx /etc/sysconfig/certbot
1717
- systemctl daemon-reload
1718
- systemctl enable certbot-renew.timer
1719
-
1720
1718
# Web server
1721
1719
export WEB="${webOption}"
1722
1720
case $WEB in
1723
1721
Apache)
1724
- /opt/certbot/bin/pip install certbot-apache
1725
1722
yum install -q -y httpd mod_ssl mod_fcgid
1726
1723
systemctl enable httpd
1727
1724
cp /etc/httpd/conf.modules.d/00-mpm.conf /etc/httpd/conf.modules.d/00-mpm.conf."`date +"%Y-%m-%d"`"
@@ -1757,7 +1754,6 @@ Resources:
1757
1754
systemctl restart httpd
1758
1755
;;
1759
1756
Nginx)
1760
- /opt/certbot/bin/pip install certbot-nginx
1761
1757
amazon-linux-extras install -y nginx1
1762
1758
systemctl enable nginx
1763
1759
0 commit comments