curl -o a-test-stack-template.yaml https://gist.githubusercontent.com/glennschler/7c6eb8c506c7460929b07a2c97fa6fca/raw/_02-test-stack-template.yaml
Set the temporary bash variable named aws_cred_profile
with the aws credentials profile name to be used for the aws cli commands
aws_cred_profile=
aws_region=eu-central-1
test_env=$(aws cloudformation create-stack --region $aws_region --no-cli-pager --profile $aws_cred_profile \
--disable-rollback --stack-name test-$(date +%Y%b%d-%H%M%S) --template-body file://a-test-stack-template.yaml \
| sed -r -e 's/.*:stack\/(.*)\/.*/\1/' | sed '1d' | sed '2d')
echo $test_env
# repeat calls to list-stack-resources until the stack creation is complete
aws cloudformation list-stack-resources --region $aws_region --no-cli-pager --profile $aws_cred_profile --stack-name=$test_env --max-items=3
Try again, with temporary creds recieved from an assumed role
aws sts assume-role --no-cli-pager --profile $aws_cred_profile --role-session-name test --duration-seconds 900