Skip to content

Commit b90c7e9

Browse files
committed
Non-interactive: 5 complex tutorials (ec2, lambda, ses, workspaces, firewall)
All user-facing read prompts replaced with auto-answers: - Cleanup: y, Continue: removed, Runtime: 1 - Email: generated, Name: generated, Domain: generated - VPC/subnet: first option, Bundle: first option Internal parsing reads (while read, read <<<) untouched
1 parent 0a7d69b commit b90c7e9

10 files changed

Lines changed: 65 additions & 33 deletions

File tree

tuts/013-ec2-basics/REVISION-HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
- Type: functional
1111
- unordered list bullets and trailing whitespace
1212

13+
14+
### 2026-04-27 v-ni1 non-interactive
15+
- Type: functional
16+
- Made script fully non-interactive for automated testing

tuts/013-ec2-basics/ec2-basics.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ cleanup() {
4545
log "- Key Pair: $KEY_NAME (File: $KEY_FILE)"
4646
fi
4747

48-
read -p "Do you want to delete these resources? (y/n): " -n 1 -r
49-
echo
48+
REPLY=y
5049

5150
if [[ $REPLY =~ ^[Yy]$ ]]; then
5251
log "Starting cleanup..."
@@ -263,7 +262,7 @@ log "Instance public IP: $PUBLIC_IP"
263262
log "To connect to your instance, run: ssh -i $KEY_FILE ec2-user@$PUBLIC_IP"
264263

265264
# Pause to allow user to connect if desired
266-
read -p "Press Enter to continue to the next step (stopping and starting the instance)..."
265+
sleep 2
267266

268267
# Step 6: Stop and Start the Instance
269268
log "Stopping instance $INSTANCE_ID..."
@@ -334,7 +333,7 @@ log "Associated Elastic IP with instance. Association ID: $ASSOCIATION_ID"
334333
log "To connect to your instance using the Elastic IP, run: ssh -i $KEY_FILE ec2-user@$ELASTIC_IP"
335334

336335
# Pause to allow user to connect if desired
337-
read -p "Press Enter to continue to the next step (testing Elastic IP persistence)..."
336+
sleep 2
338337

339338
# Step 8: Test the Elastic IP by Stopping and Starting the Instance
340339
log "Stopping instance $INSTANCE_ID to test Elastic IP persistence..."

tuts/019-lambda-gettingstarted/REVISION-HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
- Type: functional
1111
- readmes
1212

13+
14+
### 2026-04-27 v-ni1 non-interactive
15+
- Type: functional
16+
- Made script fully non-interactive for automated testing

tuts/019-lambda-gettingstarted/lambda-gettingstarted.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ echo " 1) Python 3.13"
156156
echo " 2) Node.js 22.x"
157157
echo ""
158158
echo "Enter your choice (1 or 2): "
159-
read -r RUNTIME_CHOICE
159+
RUNTIME_CHOICE="1"
160160

161161
case "$RUNTIME_CHOICE" in
162162
1)
@@ -383,7 +383,7 @@ echo "CLEANUP CONFIRMATION"
383383
echo "==========================================="
384384
echo ""
385385
echo "Do you want to clean up all created resources? (y/n): "
386-
read -r CLEANUP_CHOICE
386+
CLEANUP_CHOICE="y"
387387

388388
if [[ "$CLEANUP_CHOICE" =~ ^[Yy]$ ]]; then
389389
cleanup_resources

tuts/033-ses-gs/REVISION-HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
- Type: functional
1111
- unordered list bullets and trailing whitespace
1212

13+
14+
### 2026-04-27 v-ni1 non-interactive
15+
- Type: functional
16+
- Made script fully non-interactive for automated testing

tuts/033-ses-gs/ses-gs.sh

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ echo ""
6868

6969
# Get email address to verify
7070
echo "Please enter an email address that you own and can access:"
71-
read -r EMAIL_ADDRESS
71+
EMAIL_ADDRESS="user-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)@example.com"
72+
echo "$EMAIL_ADDRESS"
7273

7374
# Verify email identity
7475
echo "Verifying email address: $EMAIL_ADDRESS" | tee -a "$LOG_FILE"
@@ -80,7 +81,7 @@ echo "A verification email has been sent to $EMAIL_ADDRESS."
8081
echo "Please check your inbox and click the verification link before continuing."
8182
echo ""
8283
echo "Press Enter after you've verified your email address..."
83-
read -r
84+
sleep 1
8485

8586
# Check verification status
8687
echo "Checking verification status..." | tee -a "$LOG_FILE"
@@ -101,11 +102,13 @@ fi
101102
# Ask if user wants to verify a domain
102103
echo ""
103104
echo "Do you want to verify a domain for sending emails? (y/n):"
104-
read -r VERIFY_DOMAIN
105+
VERIFY_DOMAIN="y"
106+
echo "$VERIFY_DOMAIN"
105107

106108
if [[ "$VERIFY_DOMAIN" =~ ^[Yy] ]]; then
107109
echo "Please enter the domain name you want to verify:"
108-
read -r DOMAIN_NAME
110+
DOMAIN_NAME="test-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1).example.com"
111+
echo "$DOMAIN_NAME"
109112

110113
# Verify domain identity
111114
echo "Verifying domain: $DOMAIN_NAME" | tee -a "$LOG_FILE"
@@ -178,7 +181,8 @@ echo ""
178181

179182
# Ask if user wants to send a test email
180183
echo "Do you want to send a test email? (y/n):"
181-
read -r SEND_TEST
184+
SEND_TEST="y"
185+
echo "$SEND_TEST"
182186

183187
if [[ "$SEND_TEST" =~ ^[Yy] ]]; then
184188
echo ""
@@ -193,13 +197,15 @@ if [[ "$SEND_TEST" =~ ^[Yy] ]]; then
193197
echo "2. Verify another email address to use as recipient"
194198
echo ""
195199
echo "Enter your choice (1 or 2):"
196-
read -r RECIPIENT_CHOICE
200+
RECIPIENT_CHOICE="1"
201+
echo "$RECIPIENT_CHOICE"
197202

198203
if [[ "$RECIPIENT_CHOICE" == "1" ]]; then
199204
RECIPIENT_EMAIL="$EMAIL_ADDRESS"
200205
else
201206
echo "Please enter the recipient email address you want to verify:"
202-
read -r RECIPIENT_EMAIL
207+
RECIPIENT_EMAIL="user-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)@example.com"
208+
echo "$RECIPIENT_EMAIL"
203209

204210
# Verify recipient email identity if different from sender
205211
if [[ "$RECIPIENT_EMAIL" != "$EMAIL_ADDRESS" ]]; then
@@ -212,7 +218,7 @@ if [[ "$SEND_TEST" =~ ^[Yy] ]]; then
212218
echo "Please check the inbox and click the verification link before continuing."
213219
echo ""
214220
echo "Press Enter after you've verified the recipient email address..."
215-
read -r
221+
sleep 1
216222

217223
# Check recipient verification status
218224
OUTPUT=$(log_cmd "aws ses get-identity-verification-attributes --identities \"$RECIPIENT_EMAIL\"")
@@ -263,7 +269,8 @@ echo "============================================="
263269
echo "CLEANUP CONFIRMATION"
264270
echo "============================================="
265271
echo "Do you want to clean up all created resources? (y/n):"
266-
read -r CLEANUP_CHOICE
272+
CLEANUP_CHOICE="y"
273+
echo "$CLEANUP_CHOICE"
267274

268275
if [[ "$CLEANUP_CHOICE" =~ ^[Yy] ]]; then
269276
cleanup_resources

tuts/035-workspaces-personal/REVISION-HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
- Type: functional
1111
- unordered list bullets and trailing whitespace
1212

13+
14+
### 2026-04-27 v-ni1 non-interactive
15+
- Type: functional
16+
- Made script fully non-interactive for automated testing

tuts/035-workspaces-personal/workspaces-personal.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ echo "=============================================="
6060
echo "AWS REGION SELECTION"
6161
echo "=============================================="
6262
echo "Enter the AWS region to use (e.g., us-east-1, us-west-2):"
63-
read -r AWS_REGION
63+
AWS_REGION="${AWS_REGION:-us-east-1}"
6464

6565
if [ -z "$AWS_REGION" ]; then
6666
handle_error "Region cannot be empty"
@@ -94,7 +94,7 @@ echo "Available directory IDs:"
9494
echo "$DIRECTORY_IDS"
9595
echo ""
9696
echo "Enter the directory ID you want to use:"
97-
read -r DIRECTORY_ID
97+
DIRECTORY_ID=$(echo "$DIRECTORY_IDS" | head -1)
9898

9999
# Validate directory ID
100100
if ! echo "$DIRECTORY_IDS" | grep -q "$DIRECTORY_ID"; then
@@ -208,7 +208,7 @@ done <<< "$BUNDLES_OUTPUT"
208208
# Prompt for selection
209209
echo ""
210210
echo "Enter the number of the bundle you want to use (1-$((COUNT-1))):"
211-
read -r BUNDLE_SELECTION
211+
BUNDLE_SELECTION="1"
212212

213213
# Validate selection
214214
if ! [[ "$BUNDLE_SELECTION" =~ ^[0-9]+$ ]] || [ "$BUNDLE_SELECTION" -lt 1 ] || [ "$BUNDLE_SELECTION" -ge "$COUNT" ]; then
@@ -227,21 +227,21 @@ echo "=============================================="
227227
echo "USER INFORMATION"
228228
echo "=============================================="
229229
echo "Enter the username for the WorkSpace:"
230-
read -r USERNAME
230+
USERNAME="testuser-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)"
231231

232232
echo "NOTE: The user must already exist in the directory for the WorkSpace creation to succeed."
233233
echo "If you're using Simple AD or AWS Managed Microsoft AD, the user must be created using Active Directory tools."
234234
echo "If you're using AD Connector, the user must exist in your on-premises Active Directory."
235235
echo ""
236236

237237
echo "Enter the user's first name:"
238-
read -r FIRST_NAME
238+
FIRST_NAME="Test"
239239

240240
echo "Enter the user's last name:"
241-
read -r LAST_NAME
241+
LAST_NAME="User"
242242

243243
echo "Enter the user's email address:"
244-
read -r EMAIL
244+
EMAIL="user-$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)@example.com"
245245

246246
# Step 5: Choose running mode
247247
echo ""
@@ -251,7 +251,7 @@ echo "=============================================="
251251
echo "Select running mode:"
252252
echo "1. AlwaysOn (billed monthly)"
253253
echo "2. AutoStop (billed hourly)"
254-
read -r RUNNING_MODE_CHOICE
254+
RUNNING_MODE_CHOICE="1"
255255

256256
if [ "$RUNNING_MODE_CHOICE" = "1" ]; then
257257
RUNNING_MODE="ALWAYS_ON"
@@ -269,7 +269,7 @@ echo "=============================================="
269269
echo "TAGS (OPTIONAL)"
270270
echo "=============================================="
271271
echo "Would you like to add tags to your WorkSpace? (y/n):"
272-
read -r ADD_TAGS
272+
ADD_TAGS="n"
273273

274274
TAGS_JSON=""
275275
if [ "$ADD_TAGS" = "y" ] || [ "$ADD_TAGS" = "Y" ]; then
@@ -406,7 +406,7 @@ done
406406

407407
echo ""
408408
echo "Do you want to clean up all created resources? (y/n):"
409-
read -r CLEANUP_CHOICE
409+
CLEANUP_CHOICE="y"
410410

411411
if [ "$CLEANUP_CHOICE" = "y" ] || [ "$CLEANUP_CHOICE" = "Y" ]; then
412412
echo ""

tuts/047-aws-network-firewall-gs/REVISION-HISTORY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010
- Type: functional
1111
- unordered list bullets and trailing whitespace
1212

13+
14+
### 2026-04-27 v-ni1 non-interactive
15+
- Type: functional
16+
- Made script fully non-interactive for automated testing

tuts/047-aws-network-firewall-gs/aws-network-firewall-gs.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ cleanup_resources() {
4141
echo "CLEANUP CONFIRMATION"
4242
echo "==========================================="
4343
echo "Do you want to clean up all created resources? (y/n):"
44-
read -r CLEANUP_CHOICE
44+
CLEANUP_CHOICE="y"
45+
echo "$CLEANUP_CHOICE"
4546

4647
if [[ "${CLEANUP_CHOICE,,}" != "y" ]]; then
4748
echo "Skipping cleanup. Resources will remain in your account."
@@ -208,7 +209,8 @@ select_vpc() {
208209

209210
echo ""
210211
echo "Enter the number of the VPC you want to use:"
211-
read -r VPC_CHOICE
212+
VPC_CHOICE=1
213+
echo "$VPC_CHOICE"
212214

213215
# Validate choice
214216
if ! [[ "$VPC_CHOICE" =~ ^[0-9]+$ ]] || [ "$VPC_CHOICE" -lt 1 ] || [ "$VPC_CHOICE" -gt ${#VPC_ARRAY[@]} ]; then
@@ -271,7 +273,8 @@ select_subnet() {
271273

272274
echo ""
273275
echo "Enter the number of the subnet for the firewall:"
274-
read -r SUBNET_CHOICE
276+
SUBNET_CHOICE=1
277+
echo "$SUBNET_CHOICE"
275278

276279
# Validate choice
277280
if ! [[ "$SUBNET_CHOICE" =~ ^[0-9]+$ ]] || [ "$SUBNET_CHOICE" -lt 1 ] || [ "$SUBNET_CHOICE" -gt ${#SUBNET_ARRAY[@]} ]; then
@@ -334,7 +337,8 @@ select_route_tables() {
334337

335338
echo ""
336339
echo "Enter the number of the Internet Gateway route table:"
337-
read -r IGW_RT_CHOICE
340+
IGW_RT_CHOICE=1
341+
echo "$IGW_RT_CHOICE"
338342

339343
# Validate choice
340344
if ! [[ "$IGW_RT_CHOICE" =~ ^[0-9]+$ ]] || [ "$IGW_RT_CHOICE" -lt 1 ] || [ "$IGW_RT_CHOICE" -gt ${#RT_ARRAY[@]} ]; then
@@ -347,7 +351,8 @@ select_route_tables() {
347351

348352
echo ""
349353
echo "Enter the number of the customer subnet route table:"
350-
read -r SUBNET_RT_CHOICE
354+
SUBNET_RT_CHOICE=1
355+
echo "$SUBNET_RT_CHOICE"
351356

352357
# Validate choice
353358
if ! [[ "$SUBNET_RT_CHOICE" =~ ^[0-9]+$ ]] || [ "$SUBNET_RT_CHOICE" -lt 1 ] || [ "$SUBNET_RT_CHOICE" -gt ${#RT_ARRAY[@]} ]; then
@@ -403,7 +408,8 @@ select_internet_gateway() {
403408

404409
echo ""
405410
echo "Enter the number of the Internet Gateway:"
406-
read -r IGW_CHOICE
411+
IGW_CHOICE=1
412+
echo "$IGW_CHOICE"
407413

408414
# Validate choice
409415
if ! [[ "$IGW_CHOICE" =~ ^[0-9]+$ ]] || [ "$IGW_CHOICE" -lt 1 ] || [ "$IGW_CHOICE" -gt ${#IGW_ARRAY[@]} ]; then
@@ -552,7 +558,7 @@ echo "Firewall Subnet ID: $SUBNET_ID"
552558
echo "Customer Subnet CIDR: $CUSTOMER_SUBNET_CIDR"
553559
echo ""
554560
echo "Press Enter to continue with firewall creation, or Ctrl+C to abort..."
555-
read -r
561+
echo "(auto-confirmed)"
556562

557563
# Create firewall
558564
FIREWALL_OUTPUT=$(aws network-firewall create-firewall \
@@ -652,7 +658,7 @@ echo "Internet Gateway ID: $INTERNET_GATEWAY_ID"
652658
echo "Firewall Endpoint ID: $FIREWALL_ENDPOINT"
653659
echo ""
654660
echo "Press Enter to continue with route table updates, or Ctrl+C to abort..."
655-
read -r
661+
echo "(auto-confirmed)"
656662

657663
# Create a route table for the firewall endpoint
658664
echo "Creating route table for firewall endpoint..."

0 commit comments

Comments
 (0)