DEV Community

Muthu
Muthu

Posted on

4 3

Programmatically check table exist in AWS Dynamo DB from Lambda function

public boolean isTableExist(String tableName) {
        try {
            TableDescription tableDescription = dynamoDB.getTable(tableName).describe();
            System.out.println('Table description: ' + tableDescription.getTableStatus());

            return true;
        } catch (com.amazonaws.services.dynamodbv2.model.ResourceNotFoundException rnfe) {
            System.out.println("Table does not exist");
        }
        return false;

    }

Enter fullscreen mode Exit fullscreen mode

Follow me in Twitter
https://twitter.com/muthupandian_in

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay