Coder Social home page Coder Social logo

boomtap-infra's Introduction

Boomtap Infra

Prerequisites

You need:

Get a new environment up and running

There are a few steps to get there:

  1. Create an AWS account that is member of the organization

    Easiest way is using CLI's create-account command

    % aws organizations create-account --email <value> --account-name <ENVIRONMENT_NAME>
    

    Recommended: save the account id in a variable as you'll need it in the steps below.

  2. Define a profile that can assume the OrganizationAccountAccessRole

    # ~/.aws/config
    
    [profile <NAME_OF_PROFILE>]
    role_arn = arn:aws:iam::<ACCOUNT_ID>:role/OrganizationAccountAccessRole
    source_profile = default (or any profile whose credentials have the OrganizationAccountAccessRole)
    region = <REGION>
    
  3. Create a policy that allows CDK to deploy resources on this account

    pnpm policy:create <backstage|prod>

  4. Bootstrap the CDK for the new account

    cdk bootstrap /
       -c env=<ENVIRONMENT_NAME> /
       --cloudformation-execution-policies "arn:aws:iam::$ACCOUNT_ID:policy/CDKExecutionAccess" /
       [--profile <PROFILE_NAME>]
    

Updating the CDK execution policy

You might need to expand the permission that CDK currently has to deploy resources. To do so, update the CDKExecutionAccess policy with the new Actions you need and with respect to the least privilege principle.

  1. Update cdkExecutionPolicy.json
  2. Run pnpm policy:update <backstage | prod>
  3. You probably don't need to run the bootstrap script again. But try it if deployment doesn't work.

There is a limit to 5 Policy versions, so we need to delete old versions to make updates. But it’s not difficult. We simply list existing versions:

aws iam list-policy-versions \
      --policy-arn arn:aws:iam::$ACCOUNT_ID:policy/CDKExecutionAccess

And then delete the selected old version:

aws iam delete-policy-version \
      --policy-arn arn:aws:iam::$ACCOUNT_ID:policy/CDKExecutionAccess \
      --version-id <VERSION>

Other useful commands

  • pnpm build --> compile typescript to js
  • pnpm watch --> watch for changes and compile
  • pnpm test --> perform the jest unit tests
  • cdk diff --> compare deployed stack with current state
  • cdk synth --> emits the synthesized CloudFormation template

Misc

The cdk.json file tells the CDK Toolkit how to execute your app.

boomtap-infra's People

Contributors

20hertz avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.