Skip to main content

LocalStack Extension: Outages

Project description

LocalStack Outages Extension

This LocalStack extension can simulate outages for any AWS region or service.

Prerequisites

  • LocalStack Pro
  • Docker
  • Python

Installation

Before installing the extension, make sure you're logged into LocalStack. If not, log in using the following command:

localstack login

You can then install this extension using the following command:

localstack extensions install localstack-extension-outages

Configuration

The extension is configured using an API endpoint. The configuration consists of a list of rules which are greedily evaluated. Each rule consists of two attributes: service name and region. You may use the * wildcard in either of these attributes.

Start an outage for a list of specified service/region pairs using a POST request like follows:

curl --location --request POST 'http://outages.localhost.localstack.cloud:4566/outages' \
  --header 'Content-Type: application/json' \
  --data '
  [
    {
      "service": "kms",
      "region": "us-east-1"
    },
    {
      "service": "s3",
      "region": "us-*"
    }, 
    {
      "service": "lambda",
      "region": "*"
    }
  ]'

When activated, API calls to affected services and regions will return a HTTP 503 Service Unavailable error.

In the above example, following are affected:

  • KMS in us-east-1
  • S3 in all US regions (us-east-1, us-east-2, us-west-1, us-west-2, us-gov-east-1 and us-gov-west-1)
  • Lambda in all regions

Outages may be stopped by using empty list in the configuration. The following request will clear the current configuration:

curl --location --request POST 'http://outages.localhost.localstack.cloud:4566/outages' \
  --header 'Content-Type: application/json' \
  --data '[]'

To retrieve the current configuration, make the following GET call:

curl --location --request GET 'http://outages.localhost.localstack.cloud:4566/outages'

To add a new service/region rule pair to the configuration, make a PATCH call as follows:

curl --location --request PATCH 'http://outages.localhost.localstack.cloud:4566/outages' \
  --header 'Content-Type: application/json' \
  --data '[{"service": "transcribe", "region": "us-west-1"}]'

To remove a service/region rule pair from the configuration, make a DELETE call as follows:

curl --location --request DELETE 'http://outages.localhost.localstack.cloud:4566/outages' \
  --header 'Content-Type: application/json' \
  --data '[{"service": "transcribe", "region": "us-west-1"}]'

License

(c) 2023 LocalStack

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localstack-extension-outages-0.4.1.tar.gz (4.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page