Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Issue creating s3 bucket on Mac #715

Closed
rohandkn opened this issue Jan 20, 2022 · 6 comments
Closed

Issue creating s3 bucket on Mac #715

rohandkn opened this issue Jan 20, 2022 · 6 comments
Assignees
Labels
AWS bug Something isn't working

Comments

@rohandkn
Copy link

Hi, I'm attempting to install the nRF Asset Tracker into my AWS account. Upon reaching this command, I reach the following error.

npx cdk -a 'node dist/cdk/cloudformation-sourcecode.js' deploy

❌ nrf-asset-tracker-sourcecode failed: Error: nrf-asset-tracker-sourcecode: 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)

I am running on a Mac. I also see the following warning beforehand.

current credentials could not be used to assume 'arn:aws:iam::...:role/...-us-east-2', but are for the right account. Proceeding anyway.

Direnv appears to properly exporting the AWS access tokens and I don't see any clear errors there. Has anyone seen a similar issue? Thank you!

@coderbyheart
Copy link
Member

coderbyheart commented Jan 21, 2022

It seems that the bootstrap part now with CDK v2 needs to happen for any CDK usage (previously it was only needed for the second stack, which has a larger template).

Can you run it in this order?

    # One-time operation to support large CloudFormation templates in CDK
    npx cdk bootstrap aws://`aws sts get-caller-identity | jq -r '.Account' | tr -d '\n'`/${AWS_REGION}

    # Create the S3 Bucket for publishing the lambdas
    npx cdk -a 'node dist/cdk/cloudformation-sourcecode.js' deploy

    # Deploy the example (see the note below)
    #   It will prompt:
    #     Do you wish to deploy these changes (y/n)?
    #   twice (the first is for the main stack, and the second is when deploying the web application stack)
    #   Both need to be confirmed with 'y'
    npx cdk deploy '*'

    # This is a fix for a bug with AWS CloudFormation and HTTP APIs
    # See https://github.com/bifravst/aws/issues/455
    node dist/cdk/helper/addFakeRoute.js

@rohandkn
Copy link
Author

Thanks for the quick response! If I do that, I get this after the first command.

Error [ValidationError]: Stack with id nrf-asset-tracker-sourcecode does not exist

@coderbyheart
Copy link
Member

Alright, checking it now myself with a blank region.

This works:

npx cdk -a 'node dist/cdk/cloudformation-sourcecode.js' bootstrap aws://`aws sts get-caller-identity | jq -r '.Account' | tr -d '\n'`/${AWS_REGION}
npx cdk -a 'node dist/cdk/cloudformation-sourcecode.js' deploy
npx cdk deploy '*'
node dist/cdk/helper/addFakeRoute.js

Unfortunately this was not catched in the tests, because bootstrap is a per-account-and-region operation therefore the account we use for CI stays bootstrapped between CI runs. Right now it's not even possible to destroy the bootstrap resources.

Repository owner moved this from In Progress to Done in nRF Asset Tracker Development Jan 21, 2022
coderbyheart added a commit that referenced this issue Jan 21, 2022
Resources created during bootstrap are now referenced by all
CDK deploy operations.

See #715
@coderbyheart
Copy link
Member

@rohandkn kindly confirm fix.

@rohandkn
Copy link
Author

Yes, that fixed it. Thank you!

@coderbyheart
Copy link
Member

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
AWS bug Something isn't working
Projects
Development

No branches or pull requests

2 participants