Dev services for Amazon Services
Quarkus Amazon Services automatically starts a containerized AWS stack in dev mode and when running tests. So, you don’t have to start one manually. The extension client is configured automatically.
Choosing a Stack Provider
Dev Services for Amazon Services supports multiple stack providers:
-
Floci: A lightweight AWS service mock library built with Quarkus. It is the default stack provider. Not all services are supported yet, but it is actively developed and new services are added regularly.
-
MiniStack: An alternative stack provider that runs real services in a containerized environment.
-
Moto: A lightweight AWS service mock library, using the motoserver container (historically used for Cognito User Pools)
-
LocalStack: The industry standard for local AWS stack emulation. This stack is supported till version 4.13 (latest free community version).
|
Dev Services for Amazon Services does not verify if the chosen stack actually implements a mock for a given service. It will start the container and provide the configuration to the client to connect to it, regardless of whether the service is actually supported by that stack provider. |
You can configure the stack provider globally or per-service:
# Global configuration (default: floci)
quarkus.aws.devservices.provider=floci
# Per-service configuration (overrides global setting)
quarkus.dynamodb.devservices.provider=ministack
quarkus.cognito-user-pools.devservices.provider=moto
quarkus.s3.devservices.provider=floci
Enabling / Disabling Dev Services for Amazon Services
Dev Services for Amazon Services is automatically enabled for each extensions added to pom.xml except in the following situations:
-
quarkus.devservices.enabledis set tofalse -
devservices.enabledis set tofalseper extension (eg.quarkus.dynamodb.devservices.enabled=false) -
the
endpoint-overrideis configured (eg.quarkus.dynamodb.endpoint-override=http://localhost:4566) -
Your environment does not support Docker. In test mode, it will cause the test to fail. Either disable Dev Services or configure the
endpoint-override.
Every extension provides a Dev Service, including for services that none of the supported stack providers emulates.
As explained in the WARNING above, Dev Services starts the container without checking that the selected stack actually emulates the service.
If none of the supported stacks does, disable Dev Services for the service with quarkus.<service>.devservices.enabled=false and use your AWS account or set the endpoint-override.
Shared services
Stack containers are shared between Quarkus applications in dev mode by default. Set quarkus.aws.devservices.shared=false to disable sharing globally. A stack-specific setting overrides the global value:
# Disable sharing for all stack providers
quarkus.aws.devservices.shared=false
# Override the global setting for individual stack providers
quarkus.aws.devservices.floci.shared=false
quarkus.aws.devservices.ministack.shared=false
quarkus.aws.devservices.moto.shared=false
quarkus.aws.devservices.localstack.shared=false
In test mode, sharing is always disabled. Containers are identified by the quarkus-dev-service-{stack} label, where {stack} is the provider name (localstack, ministack, moto, or floci). Each stack provider uses its own name by default. To use multiple shared containers for the same provider, set its service-name property (for example, quarkus.aws.devservices.localstack.service-name).
Configuring the image
Dev Services for Amazon Services uses different default images depending on the stack provider:
-
LocalStack:
localstack/localstack:4.13 -
MiniStack:
ministackorg/ministack:latest(not a fixed version as MiniStack is still in early development) -
Moto:
motoserver/moto:latest(latest version) -
Floci:
floci/floci:latest(latest version)
You can configure the image and version using the stack-specific properties:
# Global Floci configuration
quarkus.aws.devservices.floci.image-name=floci/floci:latest
# Global MiniStack configuration
quarkus.aws.devservices.ministack.image-name=ministackorg/ministack:latest
# Global Moto configuration
quarkus.aws.devservices.moto.image-name=motoserver/moto:latest
# Global LocalStack configuration
quarkus.aws.devservices.localstack.image-name=localstack/localstack:4.13
# Per-service Floci configuration (overrides global)
quarkus.dynamodb.devservices.floci.image-name=floci/floci:latest
# Per-service MiniStack configuration (overrides global)
quarkus.dynamodb.devservices.ministack.image-name=ministackorg/ministack:latest
# Per-service Moto configuration (overrides global)
quarkus.dynamodb.devservices.moto.image-name=motoserver/moto:latest
# Per-service LocalStack configuration (overrides global)
quarkus.dynamodb.devservices.localstack.image-name=localstack/localstack:4.13
LocalStack Auth Token
To use LocalStack latest version, you need to configure the image and provide your auth token:
# Use the latest LocalStack image
quarkus.aws.devservices.localstack.image-name=localstack/localstack:latest
# Set the authentication token as a container environment variable
quarkus.aws.devservices.localstack.container-env.LOCALSTACK_AUTH_TOKEN=your-auth-token-here
You can obtain your LocalStack Pro authentication token from your LocalStack account dashboard. The token is required to access Pro features and services.
Specific configuration
Dev Services for Amazon Services can support specific properties sent to the container. It can be globally applied to all containers or be specified per service as follows:
# Global Floci configuration
quarkus.aws.devservices.floci.container-properties.FLOCI_SERVICES_S3_ENFORCE_AUTH=true
# Global LocalStack configuration
quarkus.aws.devservices.localstack.container-properties.START_WEB=0
# Global MiniStack configuration
quarkus.aws.devservices.ministack.container-properties.SOME_PROPERTY=value
# Global Moto configuration
quarkus.aws.devservices.moto.container-properties.SOME_MOTO_PROPERTY=value
# Per-service Floci configuration (overrides global)
quarkus.s3.devservices.floci.container-properties.FLOCI_SERVICES_S3_ENFORCE_AUTH=true
# Per-service LocalStack configuration (overrides global)
quarkus.dynamodb.devservices.localstack.container-properties.DYNAMODB_HEAP_SIZE=1G
# Per-service MiniStack configuration (overrides global)
quarkus.dynamodb.devservices.ministack.container-properties.SOME_PROPERTY=value
# Per-service Moto configuration (overrides global)
quarkus.dynamodb.devservices.moto.container-properties.SOME_MOTO_PROPERTY=value
Refer to the Floci documentation for Floci configuration: https://github.com/floci-io/floci. Refer to the LocalStack documentation for LocalStack configuration: https://docs.localstack.cloud/aws/capabilities/config/configuration/. For MiniStack, refer to its documentation. For Moto, refer to the Moto documentation. Note that not all environment variables are supported and some may affect Dev Services for Amazon Services.
Additional services
To start additional services for which a Quarkus extension does not exist or is not imported in the project, use the additional-services property:
# Global Floci configuration
quarkus.aws.devservices.floci.additional-services."kinesis".enabled=true
quarkus.aws.devservices.floci.additional-services."redshift".enabled=true
# Global LocalStack configuration
quarkus.aws.devservices.localstack.additional-services."kinesis".enabled=true
quarkus.aws.devservices.localstack.additional-services."redshift".enabled=true
# Global MiniStack configuration
quarkus.aws.devservices.ministack.additional-services."kinesis".enabled=true
quarkus.aws.devservices.ministack.additional-services."redshift".enabled=true
The key is the name of the service to enable and must be a valid service name for the chosen stack provider.
Init scripts
You can configure init scripts to be executed during stack startup:
# Global Floci configuration
quarkus.aws.devservices.floci.init-scripts-folder=src/test/resources/floci-init
quarkus.aws.devservices.floci.init-scripts-classpath=init-scripts
# Global LocalStack configuration
quarkus.aws.devservices.localstack.init-scripts-folder=src/test/resources/localstack-init
quarkus.aws.devservices.localstack.init-scripts-classpath=init-scripts
# Global MiniStack configuration
quarkus.aws.devservices.ministack.init-scripts-folder=src/test/resources/ministack-init
quarkus.aws.devservices.ministack.init-scripts-classpath=init-scripts
# Global Moto configuration
quarkus.aws.devservices.moto.init-scripts-folder=src/test/resources/moto-init
quarkus.aws.devservices.moto.init-scripts-classpath=init-scripts
# Per-service Floci configuration (overrides global)
quarkus.dynamodb.devservices.floci.init-scripts-folder=src/test/resources/dynamodb-init
# Per-service LocalStack configuration (overrides global)
quarkus.dynamodb.devservices.localstack.init-scripts-folder=src/test/resources/dynamodb-init
# Per-service MiniStack configuration (overrides global)
quarkus.dynamodb.devservices.ministack.init-scripts-folder=src/test/resources/dynamodb-init
# Per-service Moto configuration (overrides global)
quarkus.dynamodb.devservices.moto.init-scripts-folder=src/test/resources/dynamodb-init
The init-scripts-folder property points to a folder containing init scripts, while init-scripts-classpath points to a classpath resource. The folder-based configuration takes precedence.
To wait for the init scripts to complete before starting the application, make the last script print a specific message and configure it with the init-completion-msg property. Dev Services then waits for this message in the container logs:
quarkus.aws.devservices.floci.init-completion-msg=Init completed
Floci init scripts
Floci runs the init scripts from the /etc/floci/init/start.d folder of the container, where Dev Services mounts the configured scripts.
The default floci/floci image does not ship the AWS CLI. If your scripts use it, switch to the latest-compat image, which includes the AWS CLI and boto3:
quarkus.aws.devservices.floci.image-name=floci/floci:latest-compat
quarkus.aws.devservices.floci.init-scripts-classpath=floci-init
quarkus.aws.devservices.floci.init-completion-msg=#### Tests init completed
The AWS CLI is preconfigured to target the Floci endpoint, so the scripts can call it directly:
#!/bin/bash
aws sqs create-queue --queue-name quarkus
echo "#### Tests init completed"
Additional setup
Some extensions support additional configuration to be applied at startup. Refer to the extension documentation.
Global DevServices Configuration Reference
Configuration property fixed at build time - All other configuration properties are overridable at runtime
Configuration property |
Type |
Default |
|---|---|---|
The Floci container image to use. Environment variable: |
string |
|
If Dev Services for Amazon Services has been explicitly enabled or disabled. Dev Services are generally enabled by default, unless there is an existing configuration present. For Amazon Services, Dev Services starts a container unless Environment variable: |
boolean |
|
Indicates if the stack container managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services for Amazon Services starts a new container. Container sharing is only used in dev mode. If unset, the global Environment variable: |
boolean |
|
The value of the This property is used when you need multiple shared Floci containers. Environment variable: |
string |
|
Path to init scripts folder executed during stack startup. Environment variable: |
string |
|
Classpath to init scripts folder executed during stack startup. initScriptsFolder has higher precedence. Environment variable: |
string |
|
Specific container log message to be waiting for stack init scripts completion. Environment variable: |
string |
|
Environment variables that are passed to the container. Environment variable: |
Map<String,String> |
|
Optional fixed port the stack will listen to. Environment variable: |
int |
|
The dev services stack provider to use. Supported values: "floci" (default), "localstack", "ministack", "moto" This is a global setting that can be overridden per-service using the service-specific devservices.provider configuration. Environment variable: |
|
|
Indicates if stack containers are shared by Dev Services. Defaults to Environment variable: |
boolean |
|
The LocalStack container image to use. Environment variable: |
string |
|
If Dev Services for Amazon Services has been explicitly enabled or disabled. Dev Services are generally enabled by default, unless there is an existing configuration present. For Amazon Services, Dev Services starts a container unless Environment variable: |
boolean |
|
Indicates if the stack container managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services for Amazon Services starts a new container. Container sharing is only used in dev mode. If unset, the global Environment variable: |
boolean |
|
The value of the Environment variable: |
string |
|
Path to init scripts folder executed during stack startup. Environment variable: |
string |
|
Classpath to init scripts folder executed during stack startup. initScriptsFolder has higher precedence. Environment variable: |
string |
|
Specific container log message to be waiting for stack init scripts completion. Environment variable: |
string |
|
Environment variables that are passed to the container. Environment variable: |
Map<String,String> |
|
Optional fixed port the stack will listen to. Environment variable: |
int |
|
The MiniStack container image to use. Environment variable: |
string |
|
If Dev Services for Amazon Services has been explicitly enabled or disabled. Dev Services are generally enabled by default, unless there is an existing configuration present. For Amazon Services, Dev Services starts a container unless Environment variable: |
boolean |
|
Indicates if the stack container managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services for Amazon Services starts a new container. Container sharing is only used in dev mode. If unset, the global Environment variable: |
boolean |
|
The value of the This property is used when you need multiple shared MiniStack containers. Environment variable: |
string |
|
Path to init scripts folder executed during stack startup. Environment variable: |
string |
|
Classpath to init scripts folder executed during stack startup. initScriptsFolder has higher precedence. Environment variable: |
string |
|
Specific container log message to be waiting for stack init scripts completion. Environment variable: |
string |
|
Environment variables that are passed to the container. Environment variable: |
Map<String,String> |
|
Optional fixed port the stack will listen to. Environment variable: |
int |
|
The Moto container image to use. Environment variable: |
string |
|
If Dev Services for Amazon Services has been explicitly enabled or disabled. Dev Services are generally enabled by default, unless there is an existing configuration present. For Amazon Services, Dev Services starts a container unless Environment variable: |
boolean |
|
Indicates if the stack container managed by Quarkus Dev Services is shared. When shared, Quarkus looks for running containers using label-based service discovery. If a matching container is found, it is used, and so a second one is not started. Otherwise, Dev Services for Amazon Services starts a new container. Container sharing is only used in dev mode. If unset, the global Environment variable: |
boolean |
|
The value of the This property is used when you need multiple shared Moto containers. Environment variable: |
string |
|
Path to init scripts folder executed during stack startup. Environment variable: |
string |
|
Classpath to init scripts folder executed during stack startup. initScriptsFolder has higher precedence. Environment variable: |
string |
|
Specific container log message to be waiting for stack init scripts completion. Environment variable: |
string |
|
Environment variables that are passed to the container. Environment variable: |
Map<String,String> |
|
Optional fixed port the stack will listen to. Environment variable: |
int |
|
If a local AWS stack should be used. (default to true) If this is true and endpoint-override is not configured then a local AWS stack will be started and will be used instead of the given configuration. The local AWS stack is provided by the stack provider configured with Environment variable: |
boolean |
|
Generic properties that are pass for additional container configuration. Environment variable: |
Map<String,String> |
|
The dev services stack provider to use for this service. If not specified, the global setting from quarkus.aws.devservices.provider is used. Supported values: "floci", "localstack", "ministack", "moto" This allows per-service override of the global stack selection. Environment variable: |
|
|
If a local AWS stack should be used. (default to true) If this is true and endpoint-override is not configured then a local AWS stack will be started and will be used instead of the given configuration. The local AWS stack is provided by the stack provider configured with Environment variable: |
boolean |
|
Generic properties that are pass for additional container configuration. Environment variable: |
Map<String,String> |
|
The dev services stack provider to use for this service. If not specified, the global setting from quarkus.aws.devservices.provider is used. Supported values: "floci", "localstack", "ministack", "moto" This allows per-service override of the global stack selection. Environment variable: |
|
|
If a local AWS stack should be used. (default to true) If this is true and endpoint-override is not configured then a local AWS stack will be started and will be used instead of the given configuration. The local AWS stack is provided by the stack provider configured with Environment variable: |
boolean |
|
Generic properties that are pass for additional container configuration. Environment variable: |
Map<String,String> |
|
The dev services stack provider to use for this service. If not specified, the global setting from quarkus.aws.devservices.provider is used. Supported values: "floci", "localstack", "ministack", "moto" This allows per-service override of the global stack selection. Environment variable: |
|
|
If a local AWS stack should be used. (default to true) If this is true and endpoint-override is not configured then a local AWS stack will be started and will be used instead of the given configuration. The local AWS stack is provided by the stack provider configured with Environment variable: |
boolean |
|
Generic properties that are pass for additional container configuration. Environment variable: |
Map<String,String> |
|
The dev services stack provider to use for this service. If not specified, the global setting from quarkus.aws.devservices.provider is used. Supported values: "floci", "localstack", "ministack", "moto" This allows per-service override of the global stack selection. Environment variable: |
|