AWS systems-manager documentation change
Summary
Modified script to generate unique policy names, set default region, handle empty arrays during cleanup, and auto-confirm resource deletion.
Security assessment
Changes focus on script robustness (unique naming, default values, array handling) and automation (non-interactive cleanup). No security vulnerabilities are addressed or security features documented. Unique IDs prevent naming conflicts but aren't security fixes.
Diff
diff --git a/systems-manager/latest/userguide/example_iam_GettingStarted_046_section.md b/systems-manager/latest/userguide/example_iam_GettingStarted_046_section.md index 86f7a57be..3fd04b40b 100644 --- a//systems-manager/latest/userguide/example_iam_GettingStarted_046_section.md +++ b//systems-manager/latest/userguide/example_iam_GettingStarted_046_section.md @@ -45,0 +46 @@ There's more on GitHub. Find the complete example and learn how to set up and ru + UNIQUE_ID=$(openssl rand -hex 4) @@ -151 +152 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - read -r CURRENT_REGION + CURRENT_REGION="${AWS_DEFAULT_REGION:-us-west-2}" @@ -406 +407 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - POLICY_OUTPUT=$(log_cmd "aws iam create-policy --policy-name SSMOnboardingPolicy --policy-document file://ssm-onboarding-policy.json --output json") + POLICY_OUTPUT=$(log_cmd "aws iam create-policy --policy-name SSMOnboardingPolicy-$UNIQUE_ID --policy-document file://ssm-onboarding-policy.json --output json") @@ -411 +412 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - POLICY_ARN=$(echo "$POLICY_OUTPUT" | grep -o 'arn:aws:iam::[0-9]*:policy/SSMOnboardingPolicy') + POLICY_ARN=$(echo "$POLICY_OUTPUT" | grep -o 'arn:aws:iam::[0-9]*:policy/SSMOnboardingPolicy-[a-f0-9]*') @@ -564 +565 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - for resource in "${CREATED_RESOURCES[@]}"; do + for resource in "${CREATED_RESOURCES[@]+"${CREATED_RESOURCES[@]}"}"; do @@ -574 +575 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - read -r CLEANUP_CHOICE + CLEANUP_CHOICE="y"