Conversation
aktrepos
commented
Sep 13, 2021
- My first release.
| item_values.put("location", new AttributeValue(ipv4)); | ||
| item_values.put("date", new AttributeValue(now)); | ||
|
|
||
| final AmazonDynamoDB ddb = AmazonDynamoDBClientBuilder.defaultClient(); |
There was a problem hiding this comment.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
If you don’t explicitly set an AWS region, the SDK consults the default region provider chain to try and determine the region to use. However, the resulting delay might lead to a poor cold-start. If code portability is not an issue, consider explicitly setting the AWS region using the withRegion() method.
| item_values.put("location", new AttributeValue(ipv4)); | ||
| item_values.put("date", new AttributeValue(now)); | ||
|
|
||
| final AmazonDynamoDB ddb = AmazonDynamoDBClientBuilder.defaultClient(); |
There was a problem hiding this comment.
Recommendation generated by Amazon CodeGuru Reviewer. Leave feedback on this recommendation by replying to the comment or by reacting to the comment using emoji.
This code is written so that the client cannot be reused across invocations of the Lambda function.
To improve the performance of the Lambda function, consider using static initialization/constructor, global/static variables and singletons. It allows to keep alive and reuse HTTP connections that were established during a previous invocation.
Learn more about best practices for working with AWS Lambda functions.