Accessing AWS Systems Manager / Parameter Store's Configuration from Quarkus 📎
provides a centralized store to manage your configuration data, whether plain-text data such as database strings or secrets such as passwords.
Quarkus ships with SSM Client which provides access to SSM:
The SSM was accessed in the JAX-RS resource:
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import software.amazon.awssdk.services.ssm.SsmClient;
import software.amazon.awssdk.services.ssm.model.GetParameterRequest;
@Path("/hello")
public class GreetingResource {
@Inject
SsmClient client;
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
var req = GetParameterRequest.builder().name("greetings").build();
return this.client.getParameter(req).parameter().value();
}
}
Configuration (local development, remote cloud access)
application.properties
:
quarkus.ssm.aws.region=eu-central-1
quarkus.ssm.aws.credentials.profile-provider.profile-name=default
The credentials were maintained in ~/.aws/credentials
:
[default]
aws_access_key_id = ACCESKEYF435AERf4
aws_secret_access_key = secretpui8mnlkuasdfeaxae534
Additional dependencies:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-amazon-ssm</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>url-connection-client</artifactId>
</dependency>