Top AWS Interview Questions (2024)
What is AWS?
How AWS works?
What is AWS Availability Zone?
What is Amazon Elastic Compute Cloud (EC2)?
What is Amazon Elastic Block Store?
What is Amazon Virtual Private Cloud (Amazon VPC)?
How to create Bucket in AWS S3 in Spring Boot application?
How to delete the bucket from AWS S3 in Spring Boot application?
How to upload/store file in AWS S3 Bucket in Spring Boot application?
How AWS EC2 Works?
What is AWS Lamda?
What are different ways to trigger AWS Lamda?
What is DynamoDB in AWS?
What is DynamoDBMapper class in AWS DynamoDB?
Q: What is AWS?
Ans:
AWS (Amazon Web Services) is a comprehensive, ever-evolving cloud computing platform offered by Amazon that offers infrastructure as a service (IaaS), platform as a service (PaaS), and packaged software as a service (SaaS) products. AWS services can provide an organization with tools like compute power, database storage, and content delivery services.
Q: How AWS works?
Ans:
AWS is divided into numerous services, each of which can be customised differently depending on the needs of the user. For an AWS service, users should be able to access configuration choices as well as individual server mappings.
The Amazon Web Services portfolio includes more than 100 services, including computation, databases, infrastructure management, application development, and security. These services are classified as follows:
Compute
Storage databases
Data management
Migration
Hybrid cloud
Networking
Development tools
Management
Monitoring
Security
Governance
Big data management
Analytics
Artificial intelligence (AI)
Mobile development
Messages and notification
Q: What is AWS Availability Zone?
Ans:
Amazon Web Services offers services from dozens of data centers in a variety of availability zones (AZs) around the world. An AZ is a physical location with numerous data centers. A region is a cluster of AZs connected by low-latency network links in close proximity.
Take a look at our suggested post on AWS :
Q: What is Amazon Elastic Compute Cloud (EC2)?
Ans:
Amazon Elastic Compute Cloud (EC2) is a service providing compute capacity through virtual servers known as EC2 instances. The Amazon Elastic Compute Cloud (EC2) service provides a variety of instance types with varied capacities and sizes, each optimized to specific workload types and applications, like memory-intensive and accelerated-computing activities. AWS also has an Auto Scaling tool that allows you to dynamically adjust capacity to keep your instances healthy and performing well.
Q: Which Maven Dependencies is required to work with AWS S3?
Ans:
Spring Boot/Spring Cloud Project
You can use starter dependency calledspring-cloud-starter-aws
,
which have spring-cloud-aws-context
and spring-cloud-aws-autoconfigure
dependencies.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-aws</artifactId>
</dependency>
Refer
Example to know how use AWS S3 dependency in Spring Boot application.
Q: What is Amazon Elastic Block Store?
Ans:
When using EC2 instances, Amazon Elastic Block Store provides block-level storage volumes for persistent data storage. Amazon Elastic File System provide managed cloud-based file storage.
Q: How to connect to AWS S3 web service from Spring Boot application?
Ans:
To access Amazon S3 web service, we must first create a client connection. For this, we'll use the AmazonS3 interface:
AWSCredentials awsCredentials = new BasicAWSCredentials(
"<AWS accesskey>", "<AWS secretkey>");
And then configure the client:
AmazonS3 s3client = AmazonS3ClientBuilder
.standard()
.withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
//provide the region that you have chose while selecting AWS Region
.withRegion(Regions.US_EAST_2)
.build();
Refer
Example to connect to AWS S3 web service from
Spring
Boot application.
Q: How to get the list of files under specific Bucket in AWS S3 in Spring Boot
application?
Ans:
Use listObjects method to get all the objects/files under specified bucket.
ListObjectsRequest listObjectsRequest =
new ListObjectsRequest()
.withBucketName(bucketName);
List<String> keys = new ArrayList<>();
ObjectListing objects = amazonS3Client.listObjects(listObjectsRequest);
Refer
Example to get the list of files under specific Bucket in AWS S3 in Spring Boot application.
Q: How to download the file from Bucket in AWS S3 in Spring Boot application?
Ans:
As shown below getObject method retrieves the objects from AWS S3 Client for the given bucket and filename(keyName).
S3Object s3object = amazonS3Client.getObject(new GetObjectRequest(bucketName, keyName));
InputStream is = s3object.getObjectContent();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
int len;
byte[] buffer = new byte[4096];
while ((len = is.read(buffer, 0, buffer.length)) != -1) {
outputStream.write(buffer, 0, len);
}
return outputStream;
Refer
Example to download the file from Bucket in AWS S3 in Spring Boot application.
Q: What is Amazon Virtual Private Cloud (Amazon VPC)?
Ans:
Amazon VPC (Amazon Virtual Private Cloud) is a service that allows you to launch AWS resources in a logically isolated virtual network that you identify. Most services in your virtual private cloud can use both IPv4 and IPv6, ensuring safe and convenient access to resources and applications.
Q: How to create Bucket in AWS S3 in Spring Boot application?
Ans:
Since Amazon S3 bucket names are globally unique, you won't be able to create another bucket with the same name once it's been taken by another user.
String bucketName = "techgeeknext-bucket1";
//check if same bucket is already exist
if(s3client.doesBucketExist(bucketName)) {
LOG.info("Bucket name is not available."
+ " Try again with a different Bucket name.");
return;
}
s3client.createBucket(bucketName);
Q: How to delete the bucket from AWS S3 in Spring Boot application?
Ans:
Before we delete our bucket, we must make sure it is empty.
If this is not the case, an exception will be thrown.
Also, only the owner of a bucket can delete it despite of its permissions (Access
Control
Policies).
try {
s3client.deleteBucket("techgeeknext-bucket1");
} catch (AmazonServiceException e) {
System.err.println("e.getErrorMessage());
return;
}
Refer
Example to delete the bucket from AWS S3 in Spring Boot application.
Q: How to upload/store file in AWS S3 Bucket in Spring Boot application?
Ans:
putObject method of Amazon S3 Client is used to store the object/file into AWS S3 Bucket.
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(file.getSize());
amazonS3Client.putObject(bucketName, keyName,
file.getInputStream(), metadata);
Refer
Example to upload/store file in AWS S3 Bucket in Spring Boot application.
Q: How AWS EC2 Works?
Ans:
EC2 handles scaling according to changing needs using the AWS Management Console, AWS Command Line Interface (CLI), or AWS Software Development Kits (SDKs), and makes it easy to deploy virtual servers and maintain storage.

AMI (Amazon Machine Image) has to be created during the setup process, which involves an operating system, apps, and configurations. After launching an instance, the user can choose an AMI template or create one in the console.
Q: What is AWS Lamda?
Ans:
AWS Lambda is a serverless, event-based computing platform that Amazon offers as part of Amazon Web Services. It is a computing service which runs code to events and automatically manages the computing resources that this code requires. This was released in November 2014.
Q: What are different ways to trigger AWS Lamda?
Ans:
There are three ways to trigger AWS Lambda.
-
API Gateway event
These events are considered as standard events. It will trigger your lambda function, when somebody is calling an API Gateway For Lambda. Need to specify in the configuration to find which event type has been triggered, or serverless.yml if you are using the Serverless Framework. -
S3 events
When someone(s) modifies the contents of an S3 bucket, S3 events occur. Content modification can be done by creating, removing, or updating a file. You may decide what type of action the lambda function triggers when specifying an event, whether it creates, removes, or updates a file. -
DynamoDB events
When someone updates a record in a specific DynamoDB table, it will immediately publish all of these changes in a stream and it will also mean that the lambda will be triggered because there is data in the stream. There are two different ways in which Lambda is triggered when there are data in the stream. First, if there are certain data in the stream, i.e. a single update to the database at a certain time, the lambda will be executed only once.The second way that Lambda is triggered is to process a sequence of events together in the stream. This saves running time a lot, as streams are pretty fast.
Q: What is DynamoDB in AWS?
Ans:
- Amazon DynamoDB is a fully managed proprietary NoSQL database service that provides fast and predictable performance with seamless scalability.
- It supports key-value and document data structures
- DynamoDB allows users to create tables for your database to store and retrieve any data volume and to support any request traffic level.
Q: What is DynamoDBMapper class in AWS DynamoDB?
Ans:
The entry point for DynamoDB is the DynamoDBMapper class. It provides access to a DynamoDB endpoint and allows you to access your data from different tables, perform various CRUD operations, and execute queries and scans table.
Refer Spring Boot + DynamoDB Example to understand DynamoDBMapper.