To configure the driver to use AWS credentials authentication:
  • Configure the minimum properties required for a connection:
    • If you are using a Model file, set the Config property to provide the name and location of the Model file. For example, C:/path/to/myrest.rest.
    • If you are using the Sample property, set the Sample property to specify the endpoint that the want to connect to and sample. For example, https://example.com/countries/.
  • Set the AuthenticationMethod property to AWS.
  • Set the AccessKey property to specify your access key ID for your IAM user or AWS account root user.
  • Set the Region property to specify name of the region that hosts your AWS server .For example, us-east-1 or us-east-2. If no value is specified, the driver will use us-east-1.

    For a list of regions, refer to the AWS documentation.

  • Set the SecretKey property to specify your secret access key for an IAM user or AWS account root user.
  • Optionally, specify values for any additional properties you want to configure.

The following examples demonstrate a session using a Model file with AWS authentication enabled.

For a connection URL:

Connection conn = DriverManager.getConnection
("jdbc:datadirect:autorest:https://example.com/;AuthenticationMethod=AWS;
  Config=C:/path/to/myrest.rest;AccessKey=ABCDEFGHIJKL1EXAMPLE;Region=us-east-2;
  SecretKey=aBcdeFGhiJKLM/N1OPQRS/tUvWxyzYEXAMPLEKEY");

For a data source:

AutoRESTDataSource mds = new AutoRESTDataSource();
mds.setDescription("My Autonomous REST Data Source");
mds.setAuthenticationMethod("AWS");
mds.setConfig("C:/path/to/myrest.rest");
mds.setAccessKey("ABCDEFGHIJKL1EXAMPLE");
mds.setRegion("us-east-2");
mds.setSecretKey("aBcdeFGhiJKLM/N1OPQRS/tUvWxyzYEXAMPLEKEY");