aws-cli-local-container

Run "aws-cli" "rain" "terraform" etc , in Visual Studio Code's Remote Container

With using the VSCode's remote container extension and the files in this repo, you can aws-cli ,rain ,terraform,without installing (unwanted) stuff into your local machine's environment

We've created and tested this repo on/for Windows, but it also could work on macOS machine.

DEMO

rain(aws cloudformation)

cd /workspaces
mkdir dev01
cd dev01
rain build AWS::S3::Bucket > S3.yml

/workspaces/dev01 $ cat S3.yml

AWSTemplateFormatVersion: "2010-09-09"

Description: Template generated by rain

Resources:
  MyBucket:
    Type: AWS::S3::Bucket
    Properties:
      AccelerateConfiguration: # Optional
        AccelerationStatus: CHANGEME
      AccessControl: CHANGEME # Optional
      AnalyticsConfigurations:
        - Id: CHANGEME
          Prefix: CHANGEME # Optional
          StorageClassAnalysis:
            DataExport: # Optional
              Destination:
                BucketAccountId: CHANGEME # Optional

...

terraform (aws)

cd /workspaces
mkdir dev02
cd dev02
  • create aws.tf
cat << EOF > /workspaces/dev02/aws.tf
provider "aws" {
    region = "us-east1"
}
EOF
  • terraform init
root ➜ /workspaces/dev02 $ terraform init

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/aws...
- Installing hashicorp/aws v4.39.0...
- Installed hashicorp/aws v4.39.0 (signed by HashiCorp)

...

Features

Requirement

  • VSCode(Visual Studio Code)

    • Extension Marketplace
      • Remote Development
      • Dev Containers
  • Environment where docker contain works.

    • example... Docker desktop OR Rancher Desktop.

Installation

Usage

  1. Download this repository directory to your local machine.(or Clone this repo to your local machine)

  2. Extract aws-cli-local-container-develop.zip file.

  3. Open the Extract zipfile directory in Visual Studio Code

    1. Run VSocde.(Open VSCode)
    2. VSCode menu -> open file -> open folder.
    3. select Extract directory.
  4. Reopen In Container

    • Open remote container environment by following the vscode's popup window(, then it'll build a new container for you)

Note

  • If you rebuild the container, the contents inside the container will be reset and erased.

structure

Repository directory(Extract zipfile directory)

aws-cli-local-container-develop
  ├─.devcontainer
  │      devcontainer.json
  │      Dockerfile
  │
  ├─aws
  │      config
  │      credentials
  │
  └─ssh
          known_hosts

In the remote container

/              <- Container's root
...
├── hostdir    <- Mounted host directory (= containers all files and folders of this repository)
...
└── workspaces <- Your working directory :)

Author

sugimoto

License

thanks,

https://github.com/toricls/aws-amplify-sns-workshop-in-vscode