TODO: Add description
If available in Hex, the package can be installed
by adding cloud_cache to your list of dependencies in mix.exs:
def deps do
[
{:cloud_cache, "~> 0.1.0"}
]
endThe following configuration is available:
if Mix.env() === :test do
config :cloud_cache, CloudCache.Adapters.S3,
auto_start: true,
sandbox_enabled: true
else
config :cloud_cache, CloudCache.Adapters.S3,
auto_start: true,
sandbox_enabled: false,
retries: [
max_attempts: 10,
base_backoff_in_ms: 10,
max_backoff_in_ms: 10_000
],
access_key_id: [
{:awscli, System.get_env("AWS_PROFILE", "default"), 30},
{:awscli, System.get_env("AWS_PROFILE", "cloud_cache"), 30},
{:system, "CLOUD_CACHE_AWS_ACCESS_KEY_ID"},
{:system, "AWS_ACCESS_KEY_ID"},
:instance_role
],
secret_access_key: [
{:awscli, System.get_env("AWS_PROFILE", "default"), 30},
{:awscli, System.get_env("AWS_PROFILE", "cloud_cache"), 30},
{:system, "CLOUD_CACHE_AWS_SECRET_ACCESS_KEY"},
{:system, "AWS_SECRET_ACCESS_KEY"},
:instance_role
]
endLocalStack provides a fully functional local AWS cloud stack
that you can use to test your application without connecting
to real AWS services.
If you just want to run a single test command against LocalStack,
you can export temporary AWS credentials and override the endpoint URL:
export AWS_ACCESS_KEY_ID=test
export AWS_SECRET_ACCESS_KEY=test
export AWS_DEFAULT_REGION=us-west-1
aws --endpoint-url=http://localhost:4566 s3 lsAWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYmust be set to any non-empty value.LocalStackrecommendstest.AWS_DEFAULT_REGIONcan be any AWS region (e.g.,us-west-1orus-east-1).--endpoint-urltells the AWS Command to talk toLocalStackinstead of AWS.
Note:
LocalStackrequires the access key/secret to be set (even if they aren’t real), because its pre-signed URL signature validation checks for their presence.
For a more seamless setup, you can configure a dedicated AWS Command profile for LocalStack.
Add this profile to ~/.aws/config:
[profile localstack]
endpoint_url = http://localhost:4566
region = us-west-1
output = jsonAdd matching credentials in ~/.aws/credentials:
[localstack]
aws_access_key_id = test
aws_secret_access_key = testNow you can run commands without repeating environment variables or --endpoint-url.
For example:
aws --profile=localstack s3api create-bucket --bucket test --region us-west-1 --create-bucket-configuration LocationConstraint=us-west-1
aws s3 mb s3://test --profile localstack
aws s3 ls --profile localstackAlternatively, you can also set the AWS_PROFILE=localstack environment variable,
in which case the --profile localstack parameter can be omitted in the commands above.
For example:
export AWS_PROFILE=localstack
aws s3api create-bucket --bucket test --region us-west-1 --create-bucket-configuration LocationConstraint=us-west-1
aws s3 mb s3://test
aws s3 lsawslocal serves as a thin wrapper and a substitute for the standard aws command, enabling you to run AWS Command commands within the LocalStack environment without specifying the --endpoint-url parameter or a profile.
Install the awslocal command using the following command:
pip install awscli-localDocumentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/cloud_cache.