Skip to content

Instantly share code, notes, and snippets.

@ariesmcrae
Created May 12, 2017 03:14
Show Gist options
  • Save ariesmcrae/b72aa0f986f87977ffc2de42481c8885 to your computer and use it in GitHub Desktop.
Save ariesmcrae/b72aa0f986f87977ffc2de42481c8885 to your computer and use it in GitHub Desktop.
Amazon EC2 Systems Manager Parameter Store - get environment key/value pairs using AWS SDK Java
private static Map<String, String> parameterStore() {
final AWSSimpleSystemsManagement client = AWSSimpleSystemsManagementClientBuilder.defaultClient();
GetParametersRequest request = new GetParametersRequest();
request.withNames("driver", "host", "port", "schema", "username", "password").setWithDecryption(true);
GetParametersResult result = client.getParameters(request);
Map<String, String> store = new HashMap<>();
result.getParameters().forEach(parameter -> {
store.put(parameter.getName(), parameter.getValue());
});
return store;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment