Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on creating sandbox: This AWS account and region has not been bootstrapped #1496

Closed
oe-bayram opened this issue May 11, 2024 · 11 comments
Labels
pending-triage Incoming issues that need categorization sandbox Related to the sandbox experience

Comments

@oe-bayram
Copy link

Environment information

System:
  OS: Windows 11 10.0.22631
  CPU: ...
  Memory: ...
Binaries:
  Node: 18.16.0 - ...
  Yarn: 1.22.19 - ...
  npm: 9.5.1 - ...
  pnpm: 9.1.0 - ...
NPM Packages:
  @aws-amplify/backend: 1.0.0
  @aws-amplify/backend-cli: 1.0.1
  aws-amplify: 6.2.0
  aws-cdk: 2.140.0
  aws-cdk-lib: 2.140.0
  typescript: 5.4.5
AWS environment variables:
  AWS_NODEJS_CONNECTION_REUSE_ENABLED = 1
  AWS_SDK_LOAD_CONFIG = 1
  AWS_STS_REGIONAL_ENDPOINTS = regional
No CDK environment variables

Description

When I try to create a sandbox I always get his error message:

This AWS account and region has not been bootstrapped.
Caused By:
 ❌ Deployment failed: Error: amplify-amplifyvitereacttemplate-spieleladen-sandbox-2b171ff521: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
    at Deployments.validateBootstrapStackVersion (C:\Users\Goldweb\Spieleladen\preistool\node_modules\aws-cdk\lib\index.js:438:12210)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Deployments.buildSingleAsset (C:\Users\Goldweb\Spieleladen\preistool\node_modules\aws-cdk\lib\index.js:438:10975)
    at async Object.buildAsset (C:\Users\Goldweb\Spieleladen\preistool\node_modules\aws-cdk\lib\index.js:438:197148)     
    at async C:\Users\Goldweb\Spieleladen\preistool\node_modules\aws-cdk\lib\index.js:438:181290
amplify-amplifyvitereacttemplate-spieleladen-sandbox-2b171ff521: SSM parameter /cdk-bootstrap/hnb659fds/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)


Resolution: Run `cdk bootstrap aws://{YOUR_ACCOUNT_ID}/{YOUR_REGION}` locally to resolve this.

[Sandbox] Watching for file changes...

I bootstrapped the environment in both ways: using cdk bootstrap ... and the bootstrap process via the console.

@oe-bayram oe-bayram added the pending-triage Incoming issues that need categorization label May 11, 2024
@arundna arundna added the sandbox Related to the sandbox experience label May 13, 2024
@ykethan
Copy link
Contributor

ykethan commented May 13, 2024

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

@ykethan ykethan added the pending-response Issue is pending response from author label May 13, 2024
@oe-bayram
Copy link
Author

Yes, since I have multiple profiles, I have to use --profile but I still get the error message.

@github-actions github-actions bot removed the pending-response Issue is pending response from author label May 13, 2024
@edwardfoyle
Copy link
Member

Another thing to check is if the profile is configured to use the same region that you have bootstrapped?

@oe-bayram
Copy link
Author

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

@edwardfoyle
Copy link
Member

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.

@ykethan ykethan added the pending-response Issue is pending response from author label May 13, 2024
@oe-bayram
Copy link
Author

Yes this parameter exists and has the value 20

@github-actions github-actions bot removed the pending-response Issue is pending response from author label May 13, 2024
@oe-bayram
Copy link
Author

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.

@edwardfoyle
Copy link
Member

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

@ykethan ykethan added the pending-response Issue is pending response from author label May 13, 2024
@oe-bayram
Copy link
Author

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.

@github-actions github-actions bot removed the pending-response Issue is pending response from author label May 14, 2024
@edwardfoyle
Copy link
Member

edwardfoyle commented May 14, 2024

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.

@edwardfoyle edwardfoyle added the pending-response Issue is pending response from author label May 14, 2024
@oe-bayram
Copy link
Author

No environment variables were set before but setting AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY explicitly did help. Thanks so far.

@github-actions github-actions bot removed the pending-response Issue is pending response from author label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-triage Incoming issues that need categorization sandbox Related to the sandbox experience
Projects
None yet
Development

No branches or pull requests

4 participants