Book Image

Amazon Web Services Bootcamp

Book Image

Amazon Web Services Bootcamp

Overview of this book

AWS is at the forefront of Cloud Computing today. Businesses are adopting AWS Cloud because of its reliability, versatility, and flexible design. The main focus of this book is teaching you how to build and manage highly reliable and scalable applications and services on AWS. It will provide you with all the necessary skills to design, deploy, and manage your applications and services on the AWS cloud platform. We’ll start by exploring Amazon S3, EC2, and so on to get you well-versed with core Amazon services. Moving on, we’ll teach you how to design and deploy highly scalable and optimized workloads. You’ll also discover easy-to-follow, hands-on steps, tips, and recommendations throughout the book and get to know essential security and troubleshooting concepts. By the end of the book, you’ll be able to create a highly secure, fault tolerant, and scalable environment for your applications to run on.
Table of Contents (16 chapters)

CRUD operations


We will learn about the Create, Retrieve, Update, and Delete operations on the DynamoDB table using the Java SDK.

Create item

We will put items into the awsbootcamp table that we created in the previous section.

  • Using AmazonDynamoDB:

Let's create an item using the AmazonDynamoDB object:

Map<String, AttributeValue> item = new HashMap<>();

  
item.put("id", new AttributeValue().withN("1"));

  
item.put("name", new AttributeValue().withS("Sunil"));

  
item.put("lastName", new AttributeValue().withS("Gulabani"));

  
createItem(tableName, item); 
 
........ 
 
public void createItem(
         String tableName,
         Map<String, AttributeValue> item) { 

     PutItemRequest request = new PutItemRequest()
             .withTableName(tableName)
             .withItem(item);

     PutItemResult result = amazonDynamoDB.putItem(request);
 } 
  • Using DynamoDB:

Let's create an item using the DynamoDB object:

Item item2 = new Item()
         .withPrimaryKey("id", 2, "name...