Created
November 15, 2017 18:05
-
-
Save mikebroberts/fa279069066d9a9279e09e01d4de8f07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; | |
import com.amazonaws.services.dynamodbv2.document.*; | |
public class MyLambda { | |
private final DynamoDB dynamoDB; | |
private final String tableName; | |
public MyLambda() { | |
this.dynamoDB = new DynamoDB(AmazonDynamoDBClientBuilder.defaultClient()); | |
this.tableName = System.getenv("LOCATIONS_TABLE"); | |
} | |
public void handler(java.util.Map<String, String> input) { | |
Table table = dynamoDB.getTable(tableName); | |
Item item = new Item() | |
.withPrimaryKey("id", input.get("ID")) | |
.withString("value", input.get("value")); | |
table.putItem(item); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment