Closed oe-bayram closed 5 months ago
Hey @oe-bayram, could you ensure the profile/account that bootstrapped is being passed with sandbox command using --profile
.
https://docs.amplify.aws/react/reference/cli-commands/#ampx-sandbox-Usage
Yes, since I have multiple profiles, I have to use --profile
but I still get the error message.
Another thing to check is if the profile is configured to use the same region that you have bootstrapped?
Yes, I checked it already:
[profile preistool]
sso_session = preistool
sso_account_id = XYZ
sso_role_name = amplify-policy
region = eu-central-1
[sso-session preistool]
sso_start_url = https://XYZ.awsapps.com/start
sso_region = eu-central-1
sso_registration_scopes = sso:account:access
Can you confirm that an SSM parameter named /cdk-bootstrap/hnb659fds/version
exists in the eu-central-1
region? If not, then that region has not been successfully bootstrapped.
Yes this parameter exists and has the value 20
What I've found out so far:
If the region is not set in the config for the profile then I get the error mentioned before.
If I set it in the config then I get another error message:
[preistool]
region = eu-central-1
Error message:
Unable to build the Amplify backend definition.
Caused By: TypeError: Cannot redefine property: preistool
at Function.defineProperty (<anonymous>)
Resolution: Check your backend definition in the `amplify` folder for syntax and type errors.
I think your config file may be incorrect. The region config for a named profile should look like
[profile preistool]
region=eu-central-1
See here for more details on the format of the config file: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-format
Now I'm using an IAM user profile with AdminAccess:
In credentials:
[Spieleladen]
aws_access_key_id=MY_ACCESS_KEY_ID
aws_secret_access_key=MY_SECRET_ACCESS_KEY
In config:
[profile Spieleladen]
region=eu-central-1
Now I'm getting the same error message an dthis warning before that:
current credentials could not be used to assume 'arn:aws:iam::ACCOUNT_ID:role/cdk-hnb659fds-deploy-role-ACCOUNT_ID-eu-central-1', but are for the right account. Proceeding anyway.
where the ACCOUNT_ID
is from another profile.
I have deleted all the other profiles from the credentials and config but I still get the warning and the error message.
Do you have the AWS_PROFILE
, AWS_REGION
, or AWS_DEFAULT_REGION
environment variable set? Amplify uses the default AWS credential loading strategy which is detailed here: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html#configure-precedence. If AWS_REGION
or AWS_DEFAULT_REGION
is set, that would take precedence over the region in the config file.
No environment variables were set before but setting AWS_ACCESS_KEY_ID
and AWS_SECRET_ACCESS_KEY
explicitly did help. Thanks so far.
I have this issue as well but on a separate aws account. The credentials I use are basically identical other that their names. I can run the amplify sandbox in one account but not the other.
Ive attempted this but it does not work:
Resolution: Run cdk bootstrap aws://{My_ACCOUNT_ID}/{My_REGION}
I deleted the stack in cloud formation and initialised it again with npx ampx sandbox that seem to do the trick !
Environment information
Description
When I try to create a sandbox I always get his error message:
I bootstrapped the environment in both ways: using
cdk bootstrap ...
and the bootstrap process via the console.