I have the following ~/.aws/config
and try to run ENV=dev cdk synth --profile test --all
.
Inside CDK my code then tries to determine the profile's account number. Reading the environment variable CDK_DEFAULT_ACCOUNT
. Sadly, this is returning 001xx
, and not 200xx
.
It seems it only detects the IAM user, and does not go down the rabbit hole using the assumed role. How can I retrieve the final role's target account number inside CDK?
[default]
region = eu-central-1
[profile test]
role_arn = arn:aws:iam::200xx:role/RoleInTargetAccount
source_profile = dev_prof
mfa_serial = arn:aws:iam::001xx:mfa/lony