Skip to content

Commit ff07c35

Browse files
committed
Apply technical requirements (R1, R2, R9, R10, R13)
- R1: Add AWS_REGION to region fallback chain - R2: Replace openssl rand with /dev/urandom - R9: Remove Appendix/Generation details from READMEs - R10: Remove internal references - R13: Add REVISION-HISTORY.md
1 parent a95c3c7 commit ff07c35

10 files changed

Lines changed: 47 additions & 7 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Revision History: 179-cloudwatch-anomaly-detection
2+
3+
## Shell (CLI script)
4+
5+
### 2026-04-14 v1 published
6+
- Type: functional
7+
- Initial version
8+

tuts/179-cloudwatch-anomaly-detection/cloudwatch-anomaly-detection.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/ad.log") 2>&1
3-
REGION=${AWS_DEFAULT_REGION:-$(aws configure get region 2>/dev/null)}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
4-
RANDOM_ID=$(openssl rand -hex 4); NS="Tutorial/AD-${RANDOM_ID}"; ALARM="tut-ad-alarm-${RANDOM_ID}"
3+
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
4+
RANDOM_ID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1); NS="Tutorial/AD-${RANDOM_ID}"; ALARM="tut-ad-alarm-${RANDOM_ID}"
55
cleanup() { echo ""; echo "Cleaning up..."; aws cloudwatch delete-alarms --alarm-names "$ALARM" 2>/dev/null && echo " Deleted alarm"; aws cloudwatch delete-anomaly-detector --namespace "$NS" --metric-name Latency --stat Average 2>/dev/null && echo " Deleted detector"; rm -rf "$WORK_DIR"; echo "Done."; }
66
echo "Step 1: Publishing baseline metrics"
77
for i in $(seq 1 20); do aws cloudwatch put-metric-data --namespace "$NS" --metric-name Latency --value $((50 + RANDOM % 20)) --unit Milliseconds; done
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Revision History: 189-cloudwatch-contributor-insights
2+
3+
## Shell (CLI script)
4+
5+
### 2026-04-14 v1 published
6+
- Type: functional
7+
- Initial version
8+

tuts/189-cloudwatch-contributor-insights/cloudwatch-contributor-insights.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/tut.log") 2>&1
3-
REGION=${AWS_DEFAULT_REGION:-$(aws configure get region 2>/dev/null)}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
3+
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
44
echo "Step 1: Listing existing rules"
55
aws cloudwatch describe-insight-rules --query 'InsightRules[:5].{Name:Name,State:State}' --output table 2>/dev/null || echo " No insight rules"
66
echo "Step 2: Listing log groups for analysis"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Revision History: 195-cloudwatch-composite-alarms
2+
3+
## Shell (CLI script)
4+
5+
### 2026-04-14 v1 published
6+
- Type: functional
7+
- Initial version
8+

tuts/195-cloudwatch-composite-alarms/cloudwatch-composite-alarms.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/tut.log") 2>&1
3-
REGION=${AWS_DEFAULT_REGION:-$(aws configure get region 2>/dev/null)}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
4-
RANDOM_ID=$(openssl rand -hex 4); NS="Tutorial/Comp-${RANDOM_ID}"; A1="tut-cpu-${RANDOM_ID}"; A2="tut-mem-${RANDOM_ID}"; COMP="tut-composite-${RANDOM_ID}"
3+
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
4+
RANDOM_ID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1); NS="Tutorial/Comp-${RANDOM_ID}"; A1="tut-cpu-${RANDOM_ID}"; A2="tut-mem-${RANDOM_ID}"; COMP="tut-composite-${RANDOM_ID}"
55
cleanup() { echo "Cleaning up..."; aws cloudwatch delete-alarms --alarm-names "$COMP" "$A1" "$A2" 2>/dev/null && echo " Deleted alarms"; rm -rf "$WORK_DIR"; echo "Done."; }
66
echo "Step 1: Publishing metrics"
77
for i in $(seq 1 5); do aws cloudwatch put-metric-data --namespace "$NS" --metric-data "[{\"MetricName\":\"CPU\",\"Value\":$((RANDOM%100)),\"Unit\":\"Percent\"},{\"MetricName\":\"Memory\",\"Value\":$((RANDOM%100)),\"Unit\":\"Percent\"}]"; done
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Revision History: 210-dynamodb-list-tables
2+
3+
## Shell (CLI script)
4+
5+
### 2026-04-14 v1 published
6+
- Type: functional
7+
- Initial version
8+

tuts/210-dynamodb-list-tables/dynamodb-list-tables.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/tut.log") 2>&1
3-
REGION=${AWS_DEFAULT_REGION:-$(aws configure get region 2>/dev/null)}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
3+
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
44
echo "Step 1: Listing tables"; aws dynamodb list-tables --query 'TableNames' --output table
55
echo "Step 2: Table details"
66
T=$(aws dynamodb list-tables --query 'TableNames[0]' --output text 2>/dev/null)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Revision History: 211-iam-list-users
2+
3+
## Shell (CLI script)
4+
5+
### 2026-04-14 v1 published
6+
- Type: functional
7+
- Initial version
8+
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
WORK_DIR=$(mktemp -d); exec > >(tee -a "$WORK_DIR/tut.log") 2>&1
3-
REGION=${AWS_DEFAULT_REGION:-$(aws configure get region 2>/dev/null)}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
3+
REGION=${AWS_DEFAULT_REGION:-${AWS_REGION:-$(aws configure get region 2>/dev/null))}; [ -z "$REGION" ] && echo "ERROR: No region" && exit 1; export AWS_DEFAULT_REGION="$REGION"; echo "Region: $REGION"
44
echo "Step 1: Listing IAM users"; aws iam list-users --query 'Users[].{Name:UserName,Created:CreateDate,PasswordLastUsed:PasswordLastUsed}' --output table
55
echo "Step 2: User count"; echo " Total: $(aws iam list-users --query 'Users | length(@)' --output text) users"
66
echo ""; echo "Tutorial complete. Read-only."; rm -rf "$WORK_DIR"

0 commit comments

Comments
 (0)