=== Discovery for AWS EC2

ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]

The `org.jgroups.protocols.aws.S3_PING` is a discovery protocol using AWS S3 buckets as cluster information store that is bundled with the WildFly distribution.
To provision using Galleon, use the `jgroups-aws` layer.
Note that this layer does not update the configuration, only provisions the necessary modules.

The following minimal example updates the existing `tcp` stack to use this discovery protocol instead of `MPING`:

[source,options="nowrap"]
----
batch
/subsystem=jgroups/stack=tcp/protocol=MPING:remove()
/subsystem=jgroups/stack=tcp/protocol=org.jgroups.protocols.aws.S3_PING:add(add-index=1, module="org.jgroups.aws", properties={region_name="eu-central-1", bucket_name="jgroups-s3"})
run-batch
----

The AWS SDK (version 2.x) client used by the protocol uses the default credential store provider.
Refer to https://docs.aws.amazon.com/sdk-for-java/[AWS SDK documentation] how to generate and supply appropriate credentials.
For instance, credentials can be provided by Java system properties (`aws.accessKeyId` and `aws.secretAccessKey`),
environmental properties (`AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`), etc.

For advanced configuration options, please visit protocol's documentation https://github.com/jgroups-extras/jgroups-aws#readme[here].
