Skip to content

Commit a723c17

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 463c6aa commit a723c17

12 files changed

Lines changed: 47 additions & 31 deletions

File tree

tuts/084-lambda-sqs/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,3 @@ Free tier eligible. No charges expected for a few messages.
5858
- [Using Lambda with Amazon SQS](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html)
5959
- [Tutorial: Using Lambda with Amazon SQS](https://docs.aws.amazon.com/lambda/latest/dg/with-sqs-example.html)
6060
- [Amazon SQS visibility timeout](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.html)
61-
62-
---
63-
64-
## Appendix: Generation details
65-
66-
| Field | Value |
67-
|-------|-------|
68-
| Generation date | 2026-04-14 |
69-
| Source script | Rewritten from internal 084-lambda-sqs-2-cli-script-v2.sh |
70-
| Script test result | EXIT 0, 44s, 7 steps, clean teardown |
71-
| Issues encountered | Original used `set -e` with `log_command` wrapper (replaced with ERR trap); missing `fileb://` for payload (fixed); original used nodejs22.x (kept) |
72-
| Iterations | v1 (internal), v2 (wait-for-active + region fix), v3 (clean rewrite for publish) |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Revision History: 084-lambda-sqs
2+
3+
## Shell (CLI script)
4+
5+
### 2026-04-14 v1 published
6+
- Type: functional
7+
- Initial version
8+

tuts/084-lambda-sqs/lambda-sqs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fi
1414
export AWS_DEFAULT_REGION="$REGION"
1515
echo "Region: $REGION"
1616

17-
RANDOM_ID=$(openssl rand -hex 4)
17+
RANDOM_ID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)
1818
ROLE_NAME="lambda-sqs-role-${RANDOM_ID}"
1919
FUNCTION_NAME="sqs-processor-${RANDOM_ID}"
2020
QUEUE_NAME="lambda-tut-queue-${RANDOM_ID}"

tuts/089-lambda-sns/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,3 @@ Free tier eligible. No charges expected for a single message.
5757
- [Using Lambda with Amazon SNS](https://docs.aws.amazon.com/lambda/latest/dg/with-sns.html)
5858
- [Tutorial: Using an AWS Lambda function as a subscriber](https://docs.aws.amazon.com/lambda/latest/dg/with-sns-example.html)
5959
- [Amazon SNS message filtering](https://docs.aws.amazon.com/sns/latest/dg/sns-message-filtering.html)
60-
61-
---
62-
63-
## Appendix: Generation details
64-
65-
| Field | Value |
66-
|-------|-------|
67-
| Generation date | 2026-04-14 |
68-
| Source script | Rewritten from internal 089-lambda-sns-2-cli-script-v3.sh |
69-
| Script test result | EXIT 0, 33s, 6 steps, clean teardown |
70-
| Issues encountered | ERR trap recursion in log retrieval loop (fixed with `|| true`); `add-permission` JSON output noise (suppressed); original used nodejs18.x (upgraded to 22) |
71-
| Iterations | v1 (internal, nodejs18), v2 (wait-for-active patch), v3 (clean rewrite for publish) |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Revision History: 089-lambda-sns
2+
3+
## Shell (CLI script)
4+
5+
### 2026-04-14 v1 published
6+
- Type: functional
7+
- Initial version
8+

tuts/089-lambda-sns/lambda-sns.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fi
1414
export AWS_DEFAULT_REGION="$REGION"
1515
echo "Region: $REGION"
1616

17-
RANDOM_ID=$(openssl rand -hex 4)
17+
RANDOM_ID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)
1818
TOPIC_NAME="sns-lambda-tut-${RANDOM_ID}"
1919
ROLE_NAME="lambda-sns-role-${RANDOM_ID}"
2020
FUNCTION_NAME="sns-processor-${RANDOM_ID}"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Revision History: 097-amazon-ec2-autoscaling-gs
2+
3+
## Shell (CLI script)
4+
5+
### 2026-04-14 v1 published
6+
- Type: functional
7+
- Initial version
8+

tuts/097-amazon-ec2-autoscaling-gs/amazon-ec2-autoscaling-gs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fi
1414
export AWS_DEFAULT_REGION="$REGION"
1515
echo "Region: $REGION"
1616

17-
RANDOM_ID=$(openssl rand -hex 4)
17+
RANDOM_ID=$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 8 | head -n 1)
1818
LT_NAME="tut-lt-${RANDOM_ID}"
1919
ASG_NAME="tut-asg-${RANDOM_ID}"
2020

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

tuts/151-lambda-layers/lambda-layers.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/lambda-layers.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); LAYER_NAME="tut-layer-${RANDOM_ID}"; FUNC_NAME="tut-layer-func-${RANDOM_ID}"; ROLE_NAME="lambda-layer-role-${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); LAYER_NAME="tut-layer-${RANDOM_ID}"; FUNC_NAME="tut-layer-func-${RANDOM_ID}"; ROLE_NAME="lambda-layer-role-${RANDOM_ID}"
55
handle_error() { echo "ERROR on line $1"; trap - ERR; cleanup; exit 1; }; trap 'handle_error $LINENO' ERR
66
cleanup() { echo ""; echo "Cleaning up..."; aws lambda delete-function --function-name "$FUNC_NAME" 2>/dev/null && echo " Deleted function"; aws lambda delete-layer-version --layer-name "$LAYER_NAME" --version-number 1 2>/dev/null && echo " Deleted layer"; aws iam detach-role-policy --role-name "$ROLE_NAME" --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole 2>/dev/null; aws iam delete-role --role-name "$ROLE_NAME" 2>/dev/null && echo " Deleted role"; rm -rf "$WORK_DIR"; echo "Done."; }
77
echo "Step 1: Creating a layer"

0 commit comments

Comments
 (0)