Configuring environment variables for Lambda

We can implement this functionality in the repository-dynamodb module now. First of all, we have to remind you that all DynamoDB operations are carried out by an instance of com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper. This class is extendable and configurable. One of the configurations is a table name resolver class that implements the com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperConfig.TableNameResolver interface. What we are going to do is create a child class for DynamoDBMapper, configure it with our own table resolver, EnvironmentVariableTableNameResolver, and inject our own implementation of DynamoDBMapper wherever we need an instance of DynamoDBMapper.

Get Building Serverless Architectures now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.