Friday, November 4, 2022

AWS Config - Disable recording mode

ACCOUNT_ID="123456789"

CMD="aws sts assume-role --role-arn arn:aws:iam::${ACCOUNT_ID}:role/AWSControlTowerExecution --role-session-name AWSCLI-Session"

OUTPUT=$(bash -c "${CMD}")

export  AWS_ACCESS_KEY_ID=`echo ${OUTPUT} | jq -r '.Credentials .AccessKeyId'`

export AWS_SECRET_ACCESS_KEY=`echo ${OUTPUT} | jq -r '.Credentials .SecretAccessKey'`

export AWS_SESSION_TOKEN=`echo ${OUTPUT} | jq -r '.Credentials .SessionToken'`

aws configservice stop-configuration-recorder --configuration-recorder-name aws-controltower-BaselineConfigRecorder --region us-east-1

aws configservice stop-configuration-recorder --configuration-recorder-name aws-controltower-BaselineConfigRecorder --region us-east-2

No comments:

Post a Comment