AWS code-library medium security documentation change
Summary
1. Updated AWS CLI Wait command reference 2. Added shared bucket detection logic with security guardrails
Security assessment
Added logic prevents accidental deletion of shared S3 buckets by introducing a BUCKET_IS_SHARED check. This directly addresses a potential data loss vulnerability by implementing resource protection guardrails.
Diff
diff --git a/code-library/latest/ug/bash_2_sts_code_examples.md b/code-library/latest/ug/bash_2_sts_code_examples.md index 6d76062cf..a4e83dce3 100644 --- a//code-library/latest/ug/bash_2_sts_code_examples.md +++ b//code-library/latest/ug/bash_2_sts_code_examples.md @@ -2731 +2731 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - * [Wait](https://docs.aws.amazon.com/goto/aws-cli/ecs-2014-11-13/Wait) + * [Wait](https://docs.aws.amazon.com/goto/aws-cli/iam-2010-05-08/Wait) @@ -5737,0 +5738,9 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + # Check for shared prereq bucket + PREREQ_BUCKET=$(aws cloudformation describe-stacks --stack-name tutorial-prereqs-bucket \ + --query 'Stacks[0].Outputs[?OutputKey==`BucketName`].OutputValue' --output text 2>/dev/null) + if [ -n "$PREREQ_BUCKET" ] && [ "$PREREQ_BUCKET" != "None" ]; then + S3_BUCKET_NAME="$PREREQ_BUCKET" + BUCKET_IS_SHARED=true + echo "Using shared bucket: $S3_BUCKET_NAME" + else + BUCKET_IS_SHARED=false @@ -5738,0 +5748 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + fi @@ -6179,0 +6190 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + if [ "$BUCKET_IS_SHARED" = "false" ]; then @@ -6181,0 +6193 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + fi @@ -6219,0 +6232,9 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + # Check for shared prereq bucket + PREREQ_BUCKET=$(aws cloudformation describe-stacks --stack-name tutorial-prereqs-bucket \ + --query 'Stacks[0].Outputs[?OutputKey==`BucketName`].OutputValue' --output text 2>/dev/null) + if [ -n "$PREREQ_BUCKET" ] && [ "$PREREQ_BUCKET" != "None" ]; then + S3_BUCKET_NAME="$PREREQ_BUCKET" + BUCKET_IS_SHARED=true + echo "Using shared bucket: $S3_BUCKET_NAME" + else + BUCKET_IS_SHARED=false @@ -6220,0 +6242 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + fi