ballerinax/aws.dynamodbstreams Ballerina library

1.0.0

Overview

Amazon DynamoDB is a fully managed, serverless, key-value NoSQL database designed to run high-performance applications at any scale. DynamoDB offers built-in security, continuous backups, automated multi-region replication, in-memory caching, and data export tools. The Ballerina AWS DynamoDB streams connector provides the capability to programmatically handle AWS DynamoDB streams related operations.

This module supports Amazon DynamoDB REST API 20120810.

Setup guide

Step 1: Create an AWS account

  • If you don't already have an AWS account, you need to create one. Go to the AWS Management Console, click on "Create a new AWS Account," and follow the instructions.

Step 2: Get the access key ID and the secret access key

Once you log in to your AWS account, you need to create a user group and a user with the necessary permissions to access DynamoDB. To do this, follow the steps below:

  1. Create an AWS user group
  • Navigate to the Identity and Access Management (IAM) service. Click on "Groups" and then "Create New Group."

    Create user group
  • Enter a group name and attach the necessary policies to the group. For example, you can attach the "AmazonDynamoDBFullAccess" policy to provide full access to DynamoDB.

    Attach policy
  1. Create an IAM user
  • In the IAM console, navigate to "Users" and click on "Add user."

    Add user
  • Enter a username, tick the "Provide user access to the AWS Management Console - optional" checkbox, and click "I want to create an IAM user". This will enable programmatic access through access keys.

    Create IAM user
  • Click through the permission setup, and add the user to the user group we previously created.

    Attach user group
  • Review the details and click "Create user."

    Review user
  1. Generate access key ID and secret access key
  • Once the user is created, you will see a success message. Navigate to the "Users" tab, and select the user you created.

    View User
  • Click on the "Create access key" button to generate the access key ID and secret access key.

    Create access key
  • Follow the steps and download the CSV file containing the credentials.

    Download credentials

Quickstart

To use the dynamodbstreams connector in your Ballerina application, modify the .bal file as follows:

Step 1: Import the module

Import the ballerinax/aws.dynamodbstreams module into your Ballerina project.

import ballerinax/aws.dynamodbstreams; ### Step 2: Instantiate a new connector Instantiate a new `Client` using the access key ID, secret access key and the region. ```ballerina dynamodbstreams:Client dynamoDbStreams = check new({ awsCredentials: { accessKeyId, secretAccessKey }, region });

Step 3: Invoke the connector operation

Now, utilize the available connector operations.

Copy
public function main() returns error? {
   dynamodbstreams:DescribeStreamInput describeStreamInput = {
      streamArn: "arn:aws:dynamodb:us-east-1:134633749276:table/TestStreamTable/stream/2024-01-04T04:43:13.919"
   };
   dynamodbstreams:StreamDescription response = check dynamoDbStreams->describeStream(describeStreamInput);
}

Step 4: Run the Ballerina application

Use the following command to compile and run the Ballerina program.

Copy
bal run

Examples

The dynamodbstreams connector provides practical examples illustrating usage in various scenarios. Explore these examples.

  1. Real-time order processing This example shows how to use DynamoDB Streams API to implement a real-time order processing system.

Import

import ballerinax/aws.dynamodbstreams;Copy

Metadata

Released date: 4 months ago

Version: 1.0.0

License: Apache-2.0


Compatibility

Platform: java17

Ballerina version: 2201.8.0

GraalVM compatible: Yes


Pull count

Total: 0

Current verison: 0


Weekly downloads


Source repository


Contributors

Other versions

1.0.0