• Stars
    star
    1,047
  • Rank 44,020 (Top 0.9 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

💲 "awslocal" - Thin wrapper around the "aws" command line interface for use with LocalStack

LocalStack AWS CLI

PyPI version

This package provides the awslocal command, which is a thin wrapper around the aws command line interface for use with LocalStack.

Installation

You can install the awslocal command via pip:

pip install awscli-local[ver1]

Note that the command above also installs the latest version of the underlying AWS CLI version 1 (awscli) package. Use this command if you prefer to manage your own version of awscli (e.g., v1/v2) and install the wrapper script only:

pip install awscli-local

Note: Automatic installation of AWS CLI version 2 is currently not supported yet (at the time of writing there is no official pypi package for v2 available), but the awslocal technically also works with AWS CLI v2 (see this section for more details).

Usage

The awslocal command has the same usage as the aws command. For detailed usage, please refer to the manual pages of aws help.

Example

Instead of the following command ...

aws --endpoint-url=http://localhost:4566 kinesis list-streams

... you can simply use this:

awslocal kinesis list-streams

Configurations

You can use the following environment variables for configuration:

  • AWS_ENDPOINT_URL: The endpoint URL to connect to (takes precedence over USE_SSL/LOCALSTACK_HOST below). Useful when you have LocalStack bound to a different host (e.g., within docker-compose).
  • LOCALSTACK_HOST (deprecated): A : variable defining where to find LocalStack (default: localhost:4566).
  • USE_SSL (deprecated): Whether to use SSL when connecting to LocalStack (default: False).
  • DEFAULT_REGION: Set the default region. Overrides AWS_DEFAULT_REGION environment variable.

Completion

awscli provides a neat command completion feature which is compatible with most modern shells which can also be used with awslocal.

Usage instructions

The command completion will automatically suggest commands and parameters when using the completion key (which is typically the Tab key):

$ awslocal dynamodb d<TAB>
delete-backup                        describe-global-table
delete-item                          describe-global-table-settings
delete-table                         describe-limits
describe-backup                      describe-table
describe-continuous-backups          describe-table-replica-auto-scaling
describe-contributor-insights        describe-time-to-live
describe-endpoints

Configuration

  • Follow the official guide on setting up the command completion for the aws CLI: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-completion.html

  • While enabling the command completion for your shell, make sure to register the completion for awslocal as well.

    For example, if you are using bash, you would add the following commands to your ~/.bashrc:

    complete -C '/usr/local/bin/aws_completer' aws
    complete -C '/usr/local/bin/aws_completer' awslocal
  • Follow the instructions for the shell you are using. For some shells you might need to register a different command or enable certain compatibility plugins (like zsh).

Limitations

  • Please note that there is a known limitation for using the cloudformation package ... command with the AWS CLI v2. Currently it is not possible to specify the S3 endpoint URL, and this issue is not yet resolved on AWS side. The problem is that the AWS CLI v2 is not available as a package on pypi.org, but is instead shipped as a binary package that cannot be easily patched from awslocal. To work around this issue, you have 2 options:

    • Downgrade to the v1 AWS CLI (this is the recommended approach)
    • There is an inofficial way to install AWS CLI v2 from sources. We do not recommend this, but it is technically possible. Also, you should install these libraries in a Python virtualenv, to avoid version clashes with other libraries on your system:
virtualenv .venv
. .venv/bin/activate
pip install https://github.com/boto/botocore/archive/v2.zip https://github.com/aws/aws-cli/archive/v2.zip

Change Log

  • v0.20: Small fixes for Python 2.x backward compatibility
  • v0.19: Patch botocore to skip adding data- host prefixes to endpoint URLs
  • v0.18: Pass SYSTEMROOT env variable to fix "_Py_HashRandomization_Init" error on Windows
  • v0.17: Remove obsolete/erroneous FORCE_V2 flag
  • v0.16: Minor fix reading addressing_style in profile config
  • v0.15: Fix lookup of v1/v2 AWS CLI version, apply --s3-endpoint-url only for v1
  • v0.14: Quote file name for windows to allow folder names with spaces
  • v0.13: Fix extra requires for newer pip versions
  • v0.12: Support v1 and v2 of underlying awscli installation
  • v0.9: Add --s3-endpoint-url by default to fix "cloudformation package" command
  • v0.9: Support for DEFAULT_REGION environment variable
  • v0.8: Switch to using edge port for all service endpoints by default
  • v0.7: Apply runtime patch to aws-cli to enable --s3-endpoint-url CloudFormation parameter
  • v0.6: Start aws CLI command in-memory instead of calling external process
  • v0.5: Support piping binary files to stdout; add .bat file for Windows
  • v0.4: Minor fix for Python 3 compatibility
  • v0.3: Add support for additional service endpoints
  • v0.2: Enable SSL connections; refactor code
  • v0.1: Initial release

Alternative

This package can be replaced by a single bash alias, except for cloudformation package ... as this command requires an additional --s3-endpoint-url parameter:

alias awslocal="AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test AWS_DEFAULT_REGION=${DEFAULT_REGION:-$AWS_DEFAULT_REGION} aws --endpoint-url=http://${LOCALSTACK_HOST:-localhost}:4566"

License

This software library is released under the Apache License, Version 2.0 (see LICENSE).

More Repositories

1

localstack

💻 A fully functional local AWS cloud stack. Develop and test your cloud & Serverless apps offline
Python
53,666
star
2

serverless-localstack

⚡ Serverless plugin for running against LocalStack
JavaScript
515
star
3

aws-cdk-local

Thin wrapper script for using the AWS CDK CLI with LocalStack
JavaScript
261
star
4

terraform-local

Terraform CLI wrapper to deploy your Terraform applications directly to LocalStack
Python
181
star
5

localstack-python-client

🐍 A lightweight Python client for LocalStack
Python
174
star
6

localstack-pro-samples

Sample projects to demonstrate advanced LocalStack features
Makefile
153
star
7

localstack-java-utils

☕ Java utilities and JUnit integration for LocalStack
Java
75
star
8

pulumi-local

Thin wrapper script to use Pulumi with LocalStack
Python
71
star
9

plux

A dynamic code loading framework for building pluggable Python distributions
Python
71
star
10

localstack-terraform-samples

Repository with terraform samples for LocalStack
HCL
66
star
11

localstack-demo

Simple demo application deployed using LocalStack
Makefile
61
star
12

docs

The LocalStack documentation 📖
HTML
60
star
13

helm-charts

Helm Charts for LocalStack
Smarty
57
star
14

aws-sam-cli-local

Simple wrapper around AWS SAM CLI for use with LocalStack
Python
52
star
15

localstack-docker-extension

Simple Docker Extension to control and manage your LocalStack instance
TypeScript
39
star
16

localstack-extensions

🧩 Extend and customize LocalStack with LocalStack Extensions (beta)
Python
35
star
17

awesome-localstack

A curated list of LocalStack integrations, tools, frameworks, and platforms.
27
star
18

setup-localstack

Sets up LocalStack CLI in your GitHub Actions workflow ☁️
25
star
19

localstack-terraform-test

Utilities to run Terraform tests against LocalStack
Python
24
star
20

chalice-local

Small wrapper script to use AWS Chalice with LocalStack
Python
21
star
21

verdin

A Tinybird SDK for Python 🐦
Python
21
star
22

amplify-js-local

Simple wrapper script to allow using the Amplify JS SDK with LocalStack
JavaScript
19
star
23

serverless-python-rest-api-with-dynamodb

Serverless CRUD service exposing a REST HTTP interface integrated with LocalStack
Python
18
star
24

cockpit

LocalStack Cockpit Desktop application
17
star
25

localstack-on-k8s

Sample repository that illustrates running LocalStack on Kubernetes
Python
16
star
26

localstack-desktop

The official LocalStack Desktop Application
16
star
27

localstack-workshop

Repository with code samples for the LocalStack workshop
JavaScript
14
star
28

localstack.github.io

LocalStack website
HTML
12
star
29

localstack-cli

The LocalStack CLI packaged using pyinstaller
Makefile
12
star
30

localstack-vscode-extension

LocalStack VSCode Extension: Deploy Lambda functions to LocalStack
TypeScript
12
star
31

azure-cli-local

[unmaintained] Simple wrapper script to use Azure CLI with LocalStack
Python
11
star
32

presentations

Presentations, talks, and demos about LocalStack
HCL
10
star
33

rolo

A Python framework for building HTTP-based server applications
Python
10
star
34

localstack-github-actions-login

GitHub Action to log-in into your LocalStack account on your GitHub Actions runners
JavaScript
9
star
35

localstack-aws-sdk-examples

Test repo with sample apps & tests for various different languages/SDKs using LocalStack
Java
8
star
36

appsync-utils

Implementation of AppSync JavaScript utilities
JavaScript
8
star
37

localstack-artifacts

Miscellaneous build artifacts for the LocalStack platform
Java
7
star
38

serverless-streaming-data-pipeline

A serverless streaming data pipeline running on LocalStack
Python
7
star
39

cloud-pods

Sample repository illustrating Cloud Pods for LocalStack
JavaScript
7
star
40

local-surf

🏄 LocalSurf - a browser plugin to redirect AWS service calls to LocalStack
JavaScript
6
star
41

serverless-api-ecs-apigateway-sample

Serverless Container-based APIs with Amazon ECS and Amazon API Gateway deployed using LocalStack
HCL
6
star
42

localstack-moto-test-coverage

Repo to run moto integration tests against LocalStack for moto-fallback coverage
Python
6
star
43

ci-plugin-circleci

CircleCI Plugin (Orb) for easy configuration of LocalStack CI builds
Shell
5
star
44

localstack-plugin-loader

The dynamic code loading framework used in LocalStack
Python
5
star
45

architect-local

Architect CLI (arc.codes) for use with LocalStack
JavaScript
5
star
46

mnist-sagemaker

Demo to run the MNIST handwritten digit model on a locally running SageMaker endpoint
JavaScript
5
star
47

awslamba-go-runtime

Custom Golang runtime for the execution of AWS Lambdas
Go
5
star
48

.github

Community health files for the @localstack organization
5
star
49

localstack-pulumi-samples

Sample Pulumi projects to demonstrate LocalStack features
Python
4
star
50

localstack-stripe

Use the Stripe API in LocalStack
Python
4
star
51

amplify-localstack

Amplify Plugin to deploy resources into Localstack
JavaScript
4
star
52

snowflake-docs

Private repo for LocalStack's Snowflake emulator docs
HTML
4
star
53

homebrew-tap

Ruby
4
star
54

tinybird-workflow-push

Push Github Workflow data to tinybird
TypeScript
4
star
55

devops-barcelona-2022

LocalStack @ DevOps Bareclona 2022
Python
3
star
56

localstack-python-utils

Localstack utility for tests
Python
3
star
57

branding

Repository with various LocalStack branding assets
3
star
58

localstack-docker-debug

Python
3
star
59

pre-commit-hooks

Pre commit hooks for LocalStack repositories
Python
3
star
60

localstack-snapshot

Extracted snapshot testing library for LocalStack
Python
3
star
61

serverless-image-resizer

Serverless Image Resizer demo app for LocalStack
Python
2
star
62

cloud-pod-badge

2
star
63

appsync-graphql-api-sample

Proxy data from different resources such as DynamoDB tables & RDS databases using AppSync GraphQL APIs deployed using Serverless Framework on LocalStack
Shell
2
star
64

meta

Tooling to manage repos in the localstack org
2
star
65

localstack-dev-spaces

Sample repo for running LocalStack in Redhat Openshift Dev Spaces
Dockerfile
2
star
66

devcontainer-feature

LocalStack DevContainer Feature(s)
Shell
2
star
67

aws-java-sdk-v2-trust-certs-patch

A small java agent to patch the AWS Java SDK v2 to disable certificate name validation.
Java
1
star
68

localstack-blog.github.io

LocalStack blog
HTML
1
star
69

troubleshooting-issues

Repository of samples to reproduce localstack issues
Python
1
star
70

loan-broker-stepfunctions-lambda-app

TypeScript
1
star
71

shipyard-localstack-flask

a starter Flask project, integrated with Localstack and Shipyard
Python
1
star
72

reinvent-challenge

Repository for re:Invent "scavenger hunt" using LocalStack
Shell
1
star
73

azure-functions-local

Small wrapper script to use Azure Functions core tools with LocalStack
1
star