3

I would like to verify in my service /health check that I have a connection with my dynamodb. I am searching for something like select 1 in MySQL (its only ping the db and return 1) but for dynamodb.

I saw this post but searching for a nonexisting item is an expensive action.

Any ideas on how to only ping my db?

Tom Weinberg
  • 31
  • 1
  • 2

3 Answers3

1

The question is perhaps too broad to answer as stated. There are many ways you could set this up, depending on your concerns and constraints.

My recommendation would be to not over-think, or over-do it in terms of verifying connectivity from your service host to DynamoDB: for example just performing a periodic GetItem should be sufficient to establish basic network connectivity..

Instead of going about the problem from this angle, perhaps you might want to consider a different approach:

a) setup canary tests that exercise all your service features periodically -- these should be "fail-fast" light tests that run constantly and in the event of consistent failure you can take action

b) setup error metrics from your service and monitor on those metrics: for example, CloudWatch allows you to take action on metrics -- you will likely get more milage out of this approach than narrowly focusing on a single failure mode (ie. DynamoDB, which, as other have stated, is a Managed service with very good availability SLA)

Mike Dinescu
  • 54,171
  • 16
  • 118
  • 151
0

I believe the select 1 equivalent in DDB is Scan with a Limit of 1 item. You can read more here.

jellycsc
  • 10,904
  • 2
  • 15
  • 32
0

Dynamodb is a managed service from AWS. It is highly available anyways. Instead of using query for verifying health of dynamodb, why not setup cloudwatch metrics on your table and check for recent alarm in cloud watch concerning dynamodb. This will also prevent you from spending your read units.

Avinash Sagar
  • 527
  • 4
  • 10