AWS DynamoDB Plugin

The plugin provides functionality to interact with Amazon DynamoDB.

Installation

Example 1. build.gradle
implementation(group: 'org.vividus', name: 'vividus-plugin-aws-dynamodb', version: '0.2.13')

Configuration

Authentication

The plugin will search for credentials using the default credential provider chain in the following order:

  1. Environment variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY (the optional variable for session token is AWS_SESSION_TOKEN).

  2. The properties: system.aws.accessKeyId and system.aws.secretKey (the optional property for session token is system.aws.sessionToken).

  3. Web Identity Token credentials from the environment or container.

  4. In the default credentials file (the location of this file varies by platform).

  5. Credentials delivered through the Amazon EC2 container service if the AWS_CONTAINER_CREDENTIALS_RELATIVE_URI environment variable is set and security manager has permission to access the variable.

  6. In the instance profile credentials, which exist within the instance metadata associated with the IAM role for the EC2 instance. This step is available only when running your application on an Amazon EC2 instance, but provides the greatest ease of use and best security when working with Amazon EC2 instances.

  7. If the plugin still hasn’t found credentials by this point, client creation fails with an exception.

See the official "Working with AWS Credentials" guide to get more details.

Region Selection

The plugin will search for credentials using the default region provider chain in the following order:

  1. Environment variable: AWS_REGION.

  2. The property: system.aws.region.

  3. AWS shared configuration file (usually located at ~/.aws/config).

  4. Use the Amazon EC2 instance metadata service to determine the region of the currently running Amazon EC2 instance.

  5. If the plugin still hasn’t found a region by this point, client creation fails with an exception.

See the official "AWS Region Selection" guide to get more details.

Steps

Querying Data

Execute PartiQL SELECT statement and save the result as JSON to the specified variable.

When I execute query `$partiqlQuery` against DynamoDB and save result as JSON to $scopes variable `$variableName`
Example 2. Execute SELECT statement and validate result
When I execute query `
    SELECT * FROM Music
    WHERE Artist='Roxette' and SongTitle='The Look'
` against DynamoDB and save result as JSON to scenario variable `song`
Then JSON element from `${song}` by JSON path `$` is equal to `
{
    "Artist": "Roxette",
    "SongTitle": "The Look"
}`

Manipulating Data

Execute PartiQL INSERT, UPDATE, DELETE statements.

When I execute query `$partiqlQuery` against DynamoDB
  • $partiqlQuery - The PartiQL (A SQL-Compatible Query Language for Amazon DynamoDB) query representing the INSERT, UPDATE or DELETE statement to execute.

Example 3. Execute INSERT statement
When I execute query `
    INSERT INTO Music
    value {'Artist':'Roxette','SongTitle':'The Look'}
` against DynamoDB
Example 4. Execute UPDATE statement
When I execute query `
    UPDATE Music
    SET AwardsWon=1
    SET AwardDetail={'Grammis':[1989, 1990]}
    WHERE Artist='Roxette' and SongTitle='The Look'
` against DynamoDB
Example 5. Execute DELETE statement
When I execute query `
    DELETE FROM Music
    WHERE Artist='Roxette' and SongTitle='The Look'
` against DynamoDB