How to install LocalStack and AWS CLI on Windows

LocalStack is a fully functional local cloud stack. With LocalSatck, you can run your AWS Applications or Lambdas on your local machine without connecting to a remote cloud provider. To know more about LocalStack please check their website.

Step 1: Install Docker

Docker should be setup and running in your machine. To setup, run and test if Docker is working fine, please refer to my post on: Docker Setup.

Step 2: Pull the latest LocalStack Docker Image

Use the command below to pull the latest LocalStack Docker image
  $ docker pull localstack/localstack
Step 3: Check if LocalStack Docker Image is present

Use the command below to check if LocalStack Docker Image is present
  $ docker image ls
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    localstack/localstack   latest              e1f6434488fe        4 months ago        798MB
Step 4: Start LocalStack

Use the command below to start LocalStack 
  $ docker run --rm -p 4566:4566 -p 4571:4571 localstack/localstack
Here is the output of this command
  $ docker run --rm -p 4566:4566 -p 4571:4571 localstack/localstack
    Waiting for all LocalStack services to be ready
    2021-09-06 22:35:00,504 CRIT Supervisor is running as root.  Privileges were not dropped because no user is specified in the config file.  If you intend 	 to run as root, you can set user=root in the config file to avoid this message.
    2021-09-06 22:35:00,554 INFO supervisord started with pid 13
    2021-09-06 22:35:01,566 INFO spawned: 'infra' with pid 19
    Waiting for all LocalStack services to be ready
    (. .venv/bin/activate; exec bin/localstack start --host)
    2021-09-06 22:35:03,333 INFO success: infra entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

         __                     _______ __             __
        / /   ____  _________ _/ / ___// /_____ ______/ /__
       / /   / __ \/ ___/ __ `/ /\__ \/ __/ __ `/ ___/ //_/
      / /___/ /_/ / /__/ /_/ / /___/ / /_/ /_/ / /__/ ,<
     /_____/\____/\___/\__,_/_//____/\__/\__,_/\___/_/|_|

     💻 LocalStack CLI 0.12.17

    Waiting for all LocalStack services to be ready
    [22:35:13] starting LocalStack in host mode 💻                 localstack.py:101
    ──────────────── LocalStack Runtime Log (press CTRL-C to quit) ─────────────────
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready

    LocalStack version: 0.12.17
    LocalStack build date: 2021-08-28
    LocalStack build git hash: 50f51f8c

    Waiting for all LocalStack services to be ready
    2021-09-06T22:36:00:INFO:bootstrap.py: Execution of "load_plugin_from_path" took 1655.01ms
    2021-09-06T22:36:00:INFO:bootstrap.py: Execution of "load_plugins" took 1663.13ms
    Starting edge router (https port 4566)...
    2021-09-06T22:36:02:INFO:bootstrap.py: Execution of "prepare_installation" took 1253.54ms
    Starting mock ACM service on http port 4566 ...
    2021-09-06T22:36:03:INFO:localstack.multiserver: Starting multi API server process on port 37293
    [2021-09-06 22:36:03 +0000] [20] [INFO] Running on https://0.0.0.0:4566 (CTRL + C to quit)
    2021-09-06T22:36:03:INFO:hypercorn.error: Running on https://0.0.0.0:4566 (CTRL + C to quit)
    [2021-09-06 22:36:03 +0000] [20] [INFO] Running on http://0.0.0.0:37293 (CTRL + C to quit)
    2021-09-06T22:36:03:INFO:hypercorn.error: Running on http://0.0.0.0:37293 (CTRL + C to quit)
    Starting mock API Gateway service on http port 4566 ...
    Starting mock CloudFormation service on http port 4566 ...
    Starting mock CloudWatch service on http port 4566 ...
    Starting mock DynamoDB service on http port 4566 ...
    Waiting for all LocalStack services to be ready
    Starting mock DynamoDB Streams service on http port 4566 ...
    Starting mock EC2 service on http port 4566 ...
    Starting mock ES service on http port 4566 ...
    Starting mock Firehose service on http port 4566 ...
    Starting mock IAM service on http port 4566 ...
    Waiting for all LocalStack services to be ready
    Starting mock STS service on http port 4566 ...
    Starting mock Kinesis service on http port 4566 ...
    Starting mock KMS service on http port 4566 ...
    Starting mock Lambda service on http port 4566 ...
    Starting mock CloudWatch Logs service on http port 4566 ...
    Starting mock Redshift service on http port 4566 ...
    Starting mock Route53 service on http port 4566 ...
    Starting mock S3 service on http port 4566 ...
    Starting mock Secrets Manager service on http port 4566 ...
    Starting mock SES service on http port 4566 ...
    Starting mock SNS service on http port 4566 ...
    Starting mock SQS service on http port 4566 ...
    Starting mock SSM service on http port 4566 ...
    Waiting for all LocalStack services to be ready
    Starting mock Cloudwatch Events service on http port 4566 ...
    Starting mock StepFunctions service on http port 4566 ...
    Starting mock SWF service on http port 4566 ...
    Starting mock Resource Groups Tagging API service on http port 4566 ...
    Starting mock Resource Groups API service on http port 4566 ...
    Starting mock Support service on http port 4566 ...
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready
    2021-09-06T22:36:41:WARNING:localstack.services.plugins: Service "dynamodb" not yet available, retrying...
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready
    Waiting for all LocalStack services to be ready
    Ready.
    2021-09-06T22:37:11:INFO:bootstrap.py: Execution of "start_api_services" took 69395.46ms 
Step 5: Install AWS CLI

To install AWS CLI, please follow the instructions on: AWS Website.

Step 6: Configure a profile for LocalStack using AWS CLI

To configure a profile for Localstackusing AWS CLI, execute the command below. We need to set AWS Access Key, Secret Access Key, AWS Region and Output format. I have used the following values:
  • AWS Access Key: ajtechdeveloper
  • Secret Access Key: softwaredevelopercentral
  • AWS region: us-east-1
  • Output format: json
Here is the command:
     $aws configure --profile localstack
     AWS Access Key ID [None]: ajtechdeveloper
     AWS Secret Access Key [None]: softwaredevelopercentral
     Default region name [None]: us-east-1
     Default output format [None]: json
    

Comments

Popular Posts

Golang gRPC Microservice

Dropwizard MySQL Integration Tutorial

Asynchronous Processing (@Async) in Spring Boot