Skip to content
Ian Ellis edited this page Jan 27, 2025 · 2 revisions

Localstack in Kubernetes (K8s)

Overview

This project provides a comprehensive solution for deploying and managing AWS LocalStack in a Kubernetes (K8s) environment. LocalStack is a fully functional local AWS cloud stack, allowing developers to test their cloud applications locally without having to use AWS resources. With this project, you can run LocalStack in Kubernetes, access it via the command line interface (CLI), and manage AWS services locally. Alternatively, Docker Compose is also supported for those who prefer a simpler setup.

Table of Contents

  1. Getting Started
  2. Deployment Methods
  3. LocalStack Configuration
  4. Using LocalStack
  5. Web Access with LocalStack UI
  6. Terraform Integration
  7. Requirements
  8. Contributing
  9. License

Getting Started

To get started with LocalStack in your development environment, please follow the guide below. You can choose to deploy using Kubernetes or Docker.

Prerequisites

  • Kubernetes: Ensure you have a Kubernetes cluster running.
  • Docker: If you opt for Docker, ensure Docker and Docker Compose are installed.
  • AWS CLI: Install the AWS Command Line Interface for easy interaction with LocalStack.

Deployment Methods

Kubernetes Deployment

  1. Clone the repository to your local machine.
  2. Run the installation script to deploy LocalStack in Kubernetes:
    ./install-localstack.sh
  3. The script will set up the necessary Services and ConfigMaps to expose LocalStack.

Docker Deployment

If you prefer not to use Kubernetes, you can use Docker instead. Here's how:

  1. Update your docker-compose.yml if necessary.
  2. Run the following command:
    docker-compose up

LocalStack Configuration

LocalStack is configured to emulate multiple AWS services including, but not limited to:

  • Enabled Services: acm, apigateway, cloudformation, cloudwatch, dynamodb, ec2, es, kms, lambda, s3, etc.

Refer to the README.md file for a full list of services and their configuration.

Using LocalStack

Once LocalStack is running, you can interact with it similarly to how you would with actual AWS services. Examples of commands you can run include:

  • Listing DynamoDB tables:

    aws --endpoint-url=http://localhost:4566 dynamodb list-tables
  • Managing S3 buckets:

    aws s3 mb s3://my-bucket

You can set the AWS_ENDPOINT_URL environment variable to simplify command usage.

Web Access with LocalStack UI

The project includes a lightweight Flask application that provides web access to AWS services via LocalStack or AWS.com. The UI is configured through a config.json file that allows customization of the available services and endpoints.

Terraform Integration

In addition to command line interactions, the project provides Terraform configurations for managing resources programmatically. You can create mock EC2 instances, S3 buckets, and Elasticsearch domains using Terraform scripts provided in the terraform/ directory.

Requirements

The project has several Python dependencies, documented in the requirements.txt. Make sure to install these prior to usage.

Contributing

Contributions to this project are welcome. Please submit a pull request or raise an issue for any enhancements or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for more details.