Skip to content

bloodiadotnet/AWSCDK-Example-ECS-For-Fargate

Repository files navigation

AWS CDK - Setup Guide

This document provides step by step instructions to setup AWS CDK.

Prerequisites

  • Homebrew (for MacOS) or Chocolatey (for Windows)
  • Node.js and npm
  • AWS CDK
  • Amazon Web Services account

Setup Configuration

  • Change product: 'awscdk-example-ecs-for-fargate' to your project name in the config/default.ts file.
  • Adjust each parameter in config/<NODE_ENV>.ts as per your project requirements.
  • The parameters in config/default.ts will be overridden by those in config/<NODE_ENV>.ts.
  • Visual Studio Code (VS Code) for code editing (Download Here).
  • ESLint and Prettier plugins for VS Code for better coding practices.

Installation

Step 1: Install AWS CDK

AWS CDK is required. For MacOS, you can install it via Homebrew. For Windows, you can use Chocolatey.

  • MacOS:

    brew install aws-cdk
  • Windows:

    choco install aws-cdk

Step 2: Set AWS Environment Variables

To configure your AWS credentials and account/settings details, set the following environment variables:

  • MacOS:

    export AWS_PROFILE=<Your AWS Profile>
    export NODE_ENV=<Your Node.js environment>
  • Windows:

    $env:AWS_PROFILE="<Your AWS Profile>"
    $env:NODE_ENV="<Your Node.js environment>"

Please replace <Your AWS Profile> and <Your Node.js environment> with your actual Your AWS Profile and Node.js environment respectively.

Step 3: Install npm Packages

Navigate to your working directory and install the required npm packages:

npm install

Step 4: Compile TypeScript Code

To compile your TypeScript code into JavaScript, use:

npm run build

Step 5: Diff Your Deployment

To see the differences between your current state and the changes the AWS CDK is going to deploy, use:

cdk diff

Step 7: Deploy Your Infrastructure

To deploy your infrastructure, use the following command:

cdk deploy

Step 8: Destroy Your Infrastructure

To destroy your infrastructure, use the following command:

cdk destroy

It removes all the resources provisioned by your AWS CDK configuration. Be careful when using this command, as it will permanently destroy all your resources.

That's it. You've now deployed your infrastructure on AWS using AWS CDK!

Author

@bloodiadotnet

About

The AWSCDK-Example-ECS-For-Fargate is a hands-on project using AWS CDK to manage Amazon Web Services resources.

Topics

Resources

License

Stars

Watchers

Forks