際際滷

際際滷Share a Scribd company logo
AWS Workshop
AWS Fundamentals Hands On Sessions
Meetu Maltiar 24th March 2025
About Me
I work as Software Engineer Technical Leader @Cisco Systems Bengaluru
- I like to invest time on Technologies and Software Craftsmanship
- Former Co-organiser  BOJUG (Bangalore Open Java User Group)
- I like to participate in and attending conferences and disseminate knowledge
- I am passionate about: Cloud Computing, Functional Programming, AI/ML
Getting Started
Ensure you have AWS Free Tier account
Ensure also that you have AWS cost anomaly detection setup
Install Java 17, Maven, AWS CLI
Install IDE like Eclipse/Intellj-IDEA
Clone repository: git clone https://github.com/meetumaltiar/aws-workshop
Workshop Architecture Review
This workshop follows a modular, service-by-service approach:
1. Java SDK v2 for interacting with AWS programmatically
2. AWS CLI for scripting infrastructure
3. Capstone projects for building something functional
Have a pattern in place that can help in future coding projects
Modules Covered
 S3
 EC2
 Lambda
 API Gateway
 DynamoDB
 SNS
 SQS
 IAM
 CloudWatch
 CloudFormation
 RDS (with EC2 MySQL Client)
 Capstone Project (Full Stack Backend)
Common Setup - AWS CLI + Java + Maven
 Java 17
 Maven build with SDK dependencies
 AWS CLI con
fi
gured with aws con
fi
gure
 Code resides in src/main/java/com/aws/workshop
 Scripts lives in scripts directory
What is Amazon S3
 Simple Storage Service - launched 2006
 Focused on General Object Storage on Cloud
 Big
fi
les, small
fi
les, media content, source code, spreadsheets etc
 Scalable, Highly Available, Durable, Supports integrations with AWS
 Useful in various contexts:
 Website Hosting
 Database Backups
 Data Processing Pipelines
S3: Core Concepts
 Buckets: Container of objects we want to store within a certain namespace
 Objects: Content that we are storing within a bucket
 Access
 By URL: http://s3.amazomaws.com/<BUCKET_NAME>/<OBJECT_NAME>
 Programatically: We will see in code examples
S3: Storage Classes
 Allows to reduce costs, but with reduced features
 Examples: Standard, Intelligent, Infrequent Access, Glacier
 Each tier has di
ff
erent pricing, latency, availability
 Standard Tier (Hot Data) > Infrequent Access > Glacier (Cold Data)
 Lifecycle Rules: Automate data movement process
S3: Java Code Basics
Create a client using builder pattern:
S3Client s3 = S3Client.builder()
.region(Region.AP_SOUTH_1)
.build()
Create a putObjectRequest using builder pattern:
PutObjectRequest putObjectRequest = PutObjectRequest.builder()
.bucket(bucketName)
.key(key)
.build();
Actual invocation to put an object in S3:
s3.putObject(putObjectRequest, RequestBody.fromFile(new File(filePath)));
S3: AWS CLI
Navigate to src/main/resources/awscli/s3operations.cli
// --- AWS CLI Commands for S3 Operations ---
// 1 Create an S3 Bucket
aws s3 mb s3://my-cli-s3-bucket
// 2 Upload a File to S3
aws s3 cp file.txt s3://my-cli-s3-bucket/
// 3 List Objects in an S3 Bucket
aws s3 ls s3://my-cli-s3-bucket/
// 4 Delete an Object from S3
aws s3 rm s3://my-cli-s3-bucket/file.txt
// 5 Delete an S3 Bucket (must be empty before deleting)
aws s3 rb s3://my-cli-s3-bucket --force
AWS IAM
Identity and Access Management
Securely controls access to AWS services and resources
Includes Users, Roles, Policies and Groups
Critical for security of AWS Infrastructure
AWS IAM: Java API
Create IamClient by providing region:
IamClient iam = IamClient.builder().region(Region.AWS_GLOBAL).build();
Create User using builder pattern:
CreateUserRequest createUserRequest = CreateUserRequest.builder().userName(userName).build();
iam.createUser(createUserRequest);
Attach ReadOnlyAccess Policy:
AttachUserPolicyRequest attachPolicyRequest = AttachUserPolicyRequest.builder()
.userName(userName)
.policyArn("arn:aws:iam::aws:policy/ReadOnlyAccess")
.build();
AWS IAM: AWS CLI
# 1 Create an IAM Role with Trust Policy
aws iam create-role 
--role-name my-lambda-role 
--assume-role-policy-document file://lambda-trust-policy.json
# 2 Attach a Managed Policy to Role (e.g., AWSLambdaBasicExecutionRole)
aws iam attach-role-policy 
--role-name my-lambda-role 
--policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
# 3 Attach an Inline Policy to Role (e.g., DynamoDB access)
aws iam put-role-policy 
--role-name my-lambda-role 
--policy-name DynamoDBPutItemPolicy 
--policy-document file://dynamodb-putitem-policy.json
# 4 Get Role Details
aws iam get-role 
--role-name my-lambda-role
# 5 List Attached Policies
aws iam list-attached-role-policies 
--role-name my-lambda-role
# 6 List Inline Policies
aws iam list-role-policies 
--role-name my-lambda-role
AWS EC2
EC2 are like virtual server on Cloud
Key components: AMI, Instance Type, Security Group, key-Pair
AMI (Amazon Machine Image)
- Think of it as a blueprint for your instance
- De
fi
nes OS, pre-installed software, volume storage and boot con
fi
g
Instance Type: De
fi
nes hardware specs (CPU, RAM, Networking capacity)
- Categorised by use-case: t2.micro/t3.micro (free tier eligible), c5.large (compute optimised), r5.large (memory optimised)
- selecting right instance type is key for cost and performance needs
AWS EC2: Continued
Security Group
- Acts like a virtual
fi
rewall for your instance
- control inbound and outbound tra
ffi
c to EC2
- Rules are based on
- Port (22 for SSH, 80 for HTTP, 3306 for MySQL)
- Protocol (TCP/UDP)
Source IP range (eg 0.0.0.0/0 means public access)
Key-Pair
- A public-private key is used to SSH in your instance
- AWS stores public key and we download the private key (.pem
fi
le)
- Without key we cannot SSH to instance after creation
AWS EC2: Java API
Build Ec2Client, provide region:
Ec2Client ec2 = Ec2Client.builder().region(Region.AP_SOUTH_1).build();
Make RunInstancesRequest:
RunInstancesRequest runRequest = RunInstancesRequest.builder()
.imageId("ami-0c768662cc797cd75") //  Amazon Linux 2 (Mumbai)
.instanceType(InstanceType.T2_MICRO)
.maxCount(1)
.minCount(1)
.keyName("my-key") //  Replace with your real key pair
.securityGroupIds("sg-my-security-group")
Make RunInstances call:
RunInstancesResponse response = ec2.runInstances(runRequest);
AWS EC2: CLI
# -----------------------------------------
# EC2 Operations via AWS CLI
# -----------------------------------------
# 1 Launch an EC2 Instance (Amazon Linux 2  Free Tier Eligible)
aws ec2 run-instances 
--image-id ami-0c768662cc797cd75 
--instance-type t2.micro 
--key-name my-key 
--security-group-ids sg-06b8961f9dd1435fe 
--region ap-south-1
# 2 List All EC2 Instances
aws ec2 describe-instances 
--query "Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType,PublicIpAddress]" 
--output table 
--region ap-south-1
# 3 Stop an EC2 Instance
aws ec2 stop-instances 
--instance-ids i-xxxxxxxxxxxxxxxxx 
--region ap-south-1
# 4 Terminate an EC2 Instance
aws ec2 terminate-instances 
--instance-ids i-xxxxxxxxxxxxxxxxx 
--region ap-south-1
AWS API Gateway
Create RESTful API that triggers Lambdas
Support custom domains, authentication, rate limits
Works seamlessly with Lambda (AWS_PROXY)
CLI Script:
- create-rest-api, create-resource, put-method, put-integration
- Adds permission and deploys
AWS Lambda
Serverless function hosting
Triggered by events (API, S3, SQS, etc)
Pay only by runtime duration
Stateless and ephemeral
AWS Lambda Java API
public class LambdaHandler implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> {
@Override
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent request, Context context) {
context.getLogger().log("LambdaHandler invoked");
APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent();
response.setStatusCode(200);
response.setBody("{ "message": " Hello from Java Lambda!" }");
return response;
}
}
Implements RequestHandler, takes API Gateway event and
returns JSON response
AWS CloudFormation
Infrastructure as code (IaC)
Write cloud formation templates and call aws cloud formation: create-stack, delete-stack, describe-stacks
Declarative YAML/JSON template
AWSTemplateFormatVersion: '2010-09-09'
Description: Basic CloudFormation Template - S3 + EC2
Parameters:
KeyName:
Description: EC2 Key Pair to SSH
Type: AWS::EC2::KeyPair::KeyName
Resources:
MyS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub "workshop-demo-bucket-${AWS::AccountId}"
Automates creation of AWS resources
aws cloudformation create-stack 
--stack-name "$STACK_NAME" 
--template-body "file://$TEMPLATE_PATH" 
--parameters ParameterKey=KeyName,ParameterValue="$KEY_NAME" 
--capabilities CAPABILITY_NAMED_IAM 
--region "$REGION"
AWS DynamoDB
NoSQL key value and document oriented database
Fast scalable, managed and server-less
Free Tier: 25 GB + 200M requests/month
JAVA API:
Use DynamoDBClient for create, put, delete operations. Works with table-name and primary-key
CreateTableRequest request = CreateTableRequest.builder()
.tableName(TABLE_NAME)
.keySchema(KeySchemaElement.builder()
.attributeName("studentId")
.keyType(KeyType.HASH).build())
.attributeDefinitions(AttributeDefinition.builder()
.attributeName("studentId")
.attributeType(ScalarAttributeType.S).build())
.provisionedThroughput(ProvisionedThroughput.builder()
.readCapacityUnits(5L)
.writeCapacityUnits(5L)
.build())
.build();
AWS DynamoDB CLI
REGION="ap-south-1"
TABLE_NAME="Students"
echo " Creating DynamoDB table '$TABLE_NAME'..."
aws dynamodb create-table 
--table-name $TABLE_NAME 
--attribute-definitions AttributeName=studentId,AttributeType=S 
--key-schema AttributeName=studentId,KeyType=HASH 
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 
--region $REGION || true
echo " Waiting for table '$TABLE_NAME' to become ACTIVE..."
aws dynamodb wait table-exists 
--table-name $TABLE_NAME 
--region $REGION
echo " Table '$TABLE_NAME' is now ACTIVE."
echo " Inserting item into '$TABLE_NAME'..."
aws dynamodb put-item 
--table-name $TABLE_NAME 
--item '{"studentId": {"S": "101"}, "name": {"S": "Meetu"}, "email": {"S": "meetu@example.com"}}' 
--region $REGION
AWS SQS
Queue based asynchronous messaging
Pull model - consumers polls messages
Used for decoupling micro-services and job processing
SQS also has de-duplication queue settings to manage fail scenarios
AWS SQS Java API
Create SQS client:
SqsClient sqsClient = SqsClient.builder().region(Region.AP_SOUTH_1).build();
Create Create SQS Request:
// 1 Create Queue
CreateQueueRequest createQueueRequest = CreateQueueRequest.builder()
.queueName(queueName)
.build();
String queueUrl = sqsClient.createQueue(createQueueRequest).queueUrl();
// 2 Send Message
SendMessageRequest sendRequest = SendMessageRequest.builder()
.queueUrl(queueUrl)
.messageBody("Hello from SQS via Java!")
.build();
sqsClient.sendMessage(sendRequest);
AWS SQS CLI
# SQS CLI Commands for MyJavaQueue
# 1 Create Queue
aws sqs create-queue 
--queue-name MyJavaQueue 
--region ap-south-1
# 2 Get Queue URL
aws sqs get-queue-url 
--queue-name MyJavaQueue 
--region ap-south-1
# 3 Send Message (replace <queue-url>)
aws sqs send-message 
--queue-url <queue-url> 
--message-body "Hello from AWS CLI to SQS!" 
--region ap-south-1
# 4 Receive Message
aws sqs receive-message 
--queue-url <queue-url> 
--region ap-south-1
# 5 Delete Message (replace <receipt-handle>)
aws sqs delete-message 
--queue-url <queue-url> 
--receipt-handle <receipt-handle> 
--region ap-south-1
AWS SNS
Pub/Sub messaging service
Push based delivery to email, SMS, Lambda, HTTP
Ideal for alerts, noti
fi
cations, fan-out scenarios
Java code API:
Create SNS client
SnsClient sns = SnsClient.builder().region(Region.AP_SOUTH_1).build();
Create Topic request:
CreateTopicRequest createRequest = CreateTopicRequest.builder().name(topicName).build();
Publish Message:
// 2 Publish Message
PublishRequest pubRequest = PublishRequest.builder()
.topicArn(topicArn)
.message("Hello from AWS Java SNS!")
.build();
sns.publish(pubRequest);
AWS SNS Script
# 1 Create SNS Topic
echo " Creating SNS topic '$TOPIC_NAME'..."
TOPIC_ARN=$(aws sns create-topic 
--name $TOPIC_NAME 
--region $REGION 
--query "TopicArn" --output text)
echo " Topic created: $TOPIC_ARN"
# 2 Publish initial message
echo " Publishing welcome message to SNS..."
aws sns publish 
--topic-arn $TOPIC_ARN 
--message "Hello from AWS CLI SNS Script!" 
--region $REGION
echo " Message published to $TOPIC_NAME."
# 3 Subscribe email
echo " Subscribing email: $EMAIL"
aws sns subscribe 
--topic-arn $TOPIC_ARN 
--protocol email 
--notification-endpoint "$EMAIL" 
--region $REGION
echo " Confirmation email sent to $EMAIL. Please confirm from your inbox."
# 4 List all topics
echo " Listing all topics:"
aws sns list-topics --region $REGION
RDS + EC2 MySQL Client
Amazon RDS is relational database systems on AWS
RDS has support for PostGres, MySQL and is well managed
Backup, patching, replication are handled by RDS
CLI scripts:
- rds-script.sh for launching MySQL instance with VPC security group
- rds_ec2_testsetup.sh: Launch EC2, install MySQL, connect to RDS
Capstone Project: Student Submission Portal
Stack Includes:
 Lambda (Java)
 API Gateway (POST /submit)
 DynamoDB (store submission)
 SNS (notify admin)
Java Code Walkthrough
StudentSubmissionHandler.java: Reads request  saves to DB  sends SNS
Structure
src/
 main/java/com/aws/workshop/capstone/
 StudentSubmissionHandler.java
 model/
 service/
Capstone Project Cleanup
Scripts:
cleanup_all.sh: Tears down all major resources
cleanup_rds_ec2.sh: Deletes RDS + EC2 setup
Tips:
Con
fi
rm SNS and DynamoDB deletions
Check S3 buckets and CloudWatch logs if needed
Next Steps & Learn More
 Explore CloudTrail, VPC, EKS, EventBridge
 Try Terraform + AWS
 Dive in serverless best practices
Thanks For Participating

More Related Content

Similar to Hands-On AWS: Java SDK + CLI for Cloud Developers (11)

Automating Your Azure Environment
Automating Your Azure EnvironmentAutomating Your Azure Environment
Automating Your Azure Environment
Michael Collier
DevOps, Microservices and Serverless Architecture
DevOps, Microservices and Serverless ArchitectureDevOps, Microservices and Serverless Architecture
DevOps, Microservices and Serverless Architecture
Mikhail Prudnikov
Immutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaImmutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS Lambda
AOE
Introduction to DevOps on AWS
Introduction to DevOps on AWSIntroduction to DevOps on AWS
Introduction to DevOps on AWS
Shiva Narayanaswamy
Automating Security in Cloud Workloads with DevSecOps
Automating Security in Cloud Workloads with DevSecOps Automating Security in Cloud Workloads with DevSecOps
Automating Security in Cloud Workloads with DevSecOps
Kristana Kane
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstack
Roberto Polli
Flying Server-less on the Cloud with AWS Lambda
Flying Server-less on the Cloud with AWS LambdaFlying Server-less on the Cloud with AWS Lambda
Flying Server-less on the Cloud with AWS Lambda
Serkan zal
SoCal NodeJS Meetup 20170215_aws_lambda
SoCal NodeJS Meetup 20170215_aws_lambdaSoCal NodeJS Meetup 20170215_aws_lambda
SoCal NodeJS Meetup 20170215_aws_lambda
Stefan Deusch
Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Manage cloud infrastructures using Zend Framework 2 (and ZF1)Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Enrico Zimuel
Being Well Architected in the Cloud (Updated)
Being Well Architected in the Cloud (Updated)Being Well Architected in the Cloud (Updated)
Being Well Architected in the Cloud (Updated)
Adrian Hornsby
Scaling drupal horizontally and in cloud
Scaling drupal horizontally and in cloudScaling drupal horizontally and in cloud
Scaling drupal horizontally and in cloud
Vladimir Ilic
Automating Your Azure Environment
Automating Your Azure EnvironmentAutomating Your Azure Environment
Automating Your Azure Environment
Michael Collier
DevOps, Microservices and Serverless Architecture
DevOps, Microservices and Serverless ArchitectureDevOps, Microservices and Serverless Architecture
DevOps, Microservices and Serverless Architecture
Mikhail Prudnikov
Immutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS LambdaImmutable Deployments with AWS CloudFormation and AWS Lambda
Immutable Deployments with AWS CloudFormation and AWS Lambda
AOE
Introduction to DevOps on AWS
Introduction to DevOps on AWSIntroduction to DevOps on AWS
Introduction to DevOps on AWS
Shiva Narayanaswamy
Automating Security in Cloud Workloads with DevSecOps
Automating Security in Cloud Workloads with DevSecOps Automating Security in Cloud Workloads with DevSecOps
Automating Security in Cloud Workloads with DevSecOps
Kristana Kane
Just one-shade-of-openstack
Just one-shade-of-openstackJust one-shade-of-openstack
Just one-shade-of-openstack
Roberto Polli
Flying Server-less on the Cloud with AWS Lambda
Flying Server-less on the Cloud with AWS LambdaFlying Server-less on the Cloud with AWS Lambda
Flying Server-less on the Cloud with AWS Lambda
Serkan zal
SoCal NodeJS Meetup 20170215_aws_lambda
SoCal NodeJS Meetup 20170215_aws_lambdaSoCal NodeJS Meetup 20170215_aws_lambda
SoCal NodeJS Meetup 20170215_aws_lambda
Stefan Deusch
Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Manage cloud infrastructures using Zend Framework 2 (and ZF1)Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Manage cloud infrastructures using Zend Framework 2 (and ZF1)
Enrico Zimuel
Being Well Architected in the Cloud (Updated)
Being Well Architected in the Cloud (Updated)Being Well Architected in the Cloud (Updated)
Being Well Architected in the Cloud (Updated)
Adrian Hornsby
Scaling drupal horizontally and in cloud
Scaling drupal horizontally and in cloudScaling drupal horizontally and in cloud
Scaling drupal horizontally and in cloud
Vladimir Ilic

More from Meetu Maltiar (11)

Introducing Akka
Introducing AkkaIntroducing Akka
Introducing Akka
Meetu Maltiar
Getting Started With Scala
Getting Started With ScalaGetting Started With Scala
Getting Started With Scala
Meetu Maltiar
Fitnesse With Scala
Fitnesse With ScalaFitnesse With Scala
Fitnesse With Scala
Meetu Maltiar
Data structures in scala
Data structures in scalaData structures in scala
Data structures in scala
Meetu Maltiar
Akka 2.0 Reloaded
Akka 2.0 ReloadedAkka 2.0 Reloaded
Akka 2.0 Reloaded
Meetu Maltiar
Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheory
Meetu Maltiar
Introducing scala
Introducing scalaIntroducing scala
Introducing scala
Meetu Maltiar
Scala test
Scala testScala test
Scala test
Meetu Maltiar
Scala Collections
Scala CollectionsScala Collections
Scala Collections
Meetu Maltiar
Easy ORMness with Objectify-Appengine
Easy ORMness with Objectify-AppengineEasy ORMness with Objectify-Appengine
Easy ORMness with Objectify-Appengine
Meetu Maltiar
Getting Started With Scala
Getting Started With ScalaGetting Started With Scala
Getting Started With Scala
Meetu Maltiar
Getting Started With Scala
Getting Started With ScalaGetting Started With Scala
Getting Started With Scala
Meetu Maltiar
Fitnesse With Scala
Fitnesse With ScalaFitnesse With Scala
Fitnesse With Scala
Meetu Maltiar
Data structures in scala
Data structures in scalaData structures in scala
Data structures in scala
Meetu Maltiar
Akka 2.0 Reloaded
Akka 2.0 ReloadedAkka 2.0 Reloaded
Akka 2.0 Reloaded
Meetu Maltiar
Scala categorytheory
Scala categorytheoryScala categorytheory
Scala categorytheory
Meetu Maltiar
Introducing scala
Introducing scalaIntroducing scala
Introducing scala
Meetu Maltiar
Scala Collections
Scala CollectionsScala Collections
Scala Collections
Meetu Maltiar
Easy ORMness with Objectify-Appengine
Easy ORMness with Objectify-AppengineEasy ORMness with Objectify-Appengine
Easy ORMness with Objectify-Appengine
Meetu Maltiar
Getting Started With Scala
Getting Started With ScalaGetting Started With Scala
Getting Started With Scala
Meetu Maltiar

Recently uploaded (20)

Top Performance Testing Tools of 2025: Ensure Speed, Stability, and Scale
Top Performance Testing Tools of 2025: Ensure Speed, Stability, and ScaleTop Performance Testing Tools of 2025: Ensure Speed, Stability, and Scale
Top Performance Testing Tools of 2025: Ensure Speed, Stability, and Scale
Shubham Joshi
A Brief Introduction About Jeff Menashe
A Brief Introduction About  Jeff MenasheA Brief Introduction About  Jeff Menashe
A Brief Introduction About Jeff Menashe
Jeff Menashe
Autodesk MotionBuilder 2026 Free Download
Autodesk MotionBuilder 2026 Free DownloadAutodesk MotionBuilder 2026 Free Download
Autodesk MotionBuilder 2026 Free Download
blouch52kp
REVIEW AI Apps Empire The Future of No-Code Ai Apps is Here!
REVIEW AI Apps Empire The Future of No-Code Ai Apps is Here!REVIEW AI Apps Empire The Future of No-Code Ai Apps is Here!
REVIEW AI Apps Empire The Future of No-Code Ai Apps is Here!
stanislausGabriel
Adobe Photoshop 2025 Free crack Download
Adobe Photoshop 2025 Free crack DownloadAdobe Photoshop 2025 Free crack Download
Adobe Photoshop 2025 Free crack Download
alihamzakpa084
Lecture2_REQUIREMENT_Process__Modelss.pptx
Lecture2_REQUIREMENT_Process__Modelss.pptxLecture2_REQUIREMENT_Process__Modelss.pptx
Lecture2_REQUIREMENT_Process__Modelss.pptx
Aqsa162589
Java and AI with LangChain4j: Jakarta EE gets AI
Java and AI with LangChain4j: Jakarta EE gets AIJava and AI with LangChain4j: Jakarta EE gets AI
Java and AI with LangChain4j: Jakarta EE gets AI
Edward Burns
RocketVideos AI The Ultimate AI Video Creation Tool
RocketVideos AI   The Ultimate AI Video Creation ToolRocketVideos AI   The Ultimate AI Video Creation Tool
RocketVideos AI The Ultimate AI Video Creation Tool
Richmaven
microsoft office 2019 crack free download
microsoft office 2019 crack free downloadmicrosoft office 2019 crack free download
microsoft office 2019 crack free download
mohsinrazakpa39
The Open-Closed Principle - Part 1 - The Original Version
The Open-Closed Principle - Part 1 - The Original VersionThe Open-Closed Principle - Part 1 - The Original Version
The Open-Closed Principle - Part 1 - The Original Version
Philip Schwarz
Adobe Photoshop 2025 Free crack Download
Adobe Photoshop 2025 Free crack DownloadAdobe Photoshop 2025 Free crack Download
Adobe Photoshop 2025 Free crack Download
juttjolie9
Wondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free DownloadWondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free Download
anglekaan18
Java and AI with LangChain4j: Jakarta EE and AI
Java and AI with LangChain4j: Jakarta EE and AIJava and AI with LangChain4j: Jakarta EE and AI
Java and AI with LangChain4j: Jakarta EE and AI
Edward Burns
Lumion Pro Crack latest version Free 2025
Lumion Pro Crack latest version Free 2025Lumion Pro Crack latest version Free 2025
Lumion Pro Crack latest version Free 2025
naeem55ddf
From Tracks to Highways: Boosting Infrastructure Safety with Mobile Edge AIoT
From Tracks to Highways: Boosting Infrastructure Safety with Mobile Edge AIoTFrom Tracks to Highways: Boosting Infrastructure Safety with Mobile Edge AIoT
From Tracks to Highways: Boosting Infrastructure Safety with Mobile Edge AIoT
Eurotech
4K Video Downloader Crack + License Key 2025
4K Video Downloader Crack + License Key 20254K Video Downloader Crack + License Key 2025
4K Video Downloader Crack + License Key 2025
yelenayoko
Enaviya Informtion Technologies Pvt Ltd & SpendMantra.pdf
Enaviya Informtion Technologies Pvt Ltd & SpendMantra.pdfEnaviya Informtion Technologies Pvt Ltd & SpendMantra.pdf
Enaviya Informtion Technologies Pvt Ltd & SpendMantra.pdf
Enaviya Information Technologies Pvt. ltd.
Marketo User Group - Singapore - April 2025
Marketo User Group - Singapore - April 2025Marketo User Group - Singapore - April 2025
Marketo User Group - Singapore - April 2025
BradBedford3
Movavi Video Editor Crack + Activation Key [2025]
Movavi Video Editor Crack + Activation Key [2025]Movavi Video Editor Crack + Activation Key [2025]
Movavi Video Editor Crack + Activation Key [2025]
l07307095
The Future of Microsoft Project Management Tools - Connecting Teams, Work, an...
The Future of Microsoft Project Management Tools - Connecting Teams, Work, an...The Future of Microsoft Project Management Tools - Connecting Teams, Work, an...
The Future of Microsoft Project Management Tools - Connecting Teams, Work, an...
OnePlan Solutions
Top Performance Testing Tools of 2025: Ensure Speed, Stability, and Scale
Top Performance Testing Tools of 2025: Ensure Speed, Stability, and ScaleTop Performance Testing Tools of 2025: Ensure Speed, Stability, and Scale
Top Performance Testing Tools of 2025: Ensure Speed, Stability, and Scale
Shubham Joshi
A Brief Introduction About Jeff Menashe
A Brief Introduction About  Jeff MenasheA Brief Introduction About  Jeff Menashe
A Brief Introduction About Jeff Menashe
Jeff Menashe
Autodesk MotionBuilder 2026 Free Download
Autodesk MotionBuilder 2026 Free DownloadAutodesk MotionBuilder 2026 Free Download
Autodesk MotionBuilder 2026 Free Download
blouch52kp
REVIEW AI Apps Empire The Future of No-Code Ai Apps is Here!
REVIEW AI Apps Empire The Future of No-Code Ai Apps is Here!REVIEW AI Apps Empire The Future of No-Code Ai Apps is Here!
REVIEW AI Apps Empire The Future of No-Code Ai Apps is Here!
stanislausGabriel
Adobe Photoshop 2025 Free crack Download
Adobe Photoshop 2025 Free crack DownloadAdobe Photoshop 2025 Free crack Download
Adobe Photoshop 2025 Free crack Download
alihamzakpa084
Lecture2_REQUIREMENT_Process__Modelss.pptx
Lecture2_REQUIREMENT_Process__Modelss.pptxLecture2_REQUIREMENT_Process__Modelss.pptx
Lecture2_REQUIREMENT_Process__Modelss.pptx
Aqsa162589
Java and AI with LangChain4j: Jakarta EE gets AI
Java and AI with LangChain4j: Jakarta EE gets AIJava and AI with LangChain4j: Jakarta EE gets AI
Java and AI with LangChain4j: Jakarta EE gets AI
Edward Burns
RocketVideos AI The Ultimate AI Video Creation Tool
RocketVideos AI   The Ultimate AI Video Creation ToolRocketVideos AI   The Ultimate AI Video Creation Tool
RocketVideos AI The Ultimate AI Video Creation Tool
Richmaven
microsoft office 2019 crack free download
microsoft office 2019 crack free downloadmicrosoft office 2019 crack free download
microsoft office 2019 crack free download
mohsinrazakpa39
The Open-Closed Principle - Part 1 - The Original Version
The Open-Closed Principle - Part 1 - The Original VersionThe Open-Closed Principle - Part 1 - The Original Version
The Open-Closed Principle - Part 1 - The Original Version
Philip Schwarz
Adobe Photoshop 2025 Free crack Download
Adobe Photoshop 2025 Free crack DownloadAdobe Photoshop 2025 Free crack Download
Adobe Photoshop 2025 Free crack Download
juttjolie9
Wondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free DownloadWondershare Filmora 14.3.2 Crack + License Key Free Download
Wondershare Filmora 14.3.2 Crack + License Key Free Download
anglekaan18
Java and AI with LangChain4j: Jakarta EE and AI
Java and AI with LangChain4j: Jakarta EE and AIJava and AI with LangChain4j: Jakarta EE and AI
Java and AI with LangChain4j: Jakarta EE and AI
Edward Burns
Lumion Pro Crack latest version Free 2025
Lumion Pro Crack latest version Free 2025Lumion Pro Crack latest version Free 2025
Lumion Pro Crack latest version Free 2025
naeem55ddf
From Tracks to Highways: Boosting Infrastructure Safety with Mobile Edge AIoT
From Tracks to Highways: Boosting Infrastructure Safety with Mobile Edge AIoTFrom Tracks to Highways: Boosting Infrastructure Safety with Mobile Edge AIoT
From Tracks to Highways: Boosting Infrastructure Safety with Mobile Edge AIoT
Eurotech
4K Video Downloader Crack + License Key 2025
4K Video Downloader Crack + License Key 20254K Video Downloader Crack + License Key 2025
4K Video Downloader Crack + License Key 2025
yelenayoko
Marketo User Group - Singapore - April 2025
Marketo User Group - Singapore - April 2025Marketo User Group - Singapore - April 2025
Marketo User Group - Singapore - April 2025
BradBedford3
Movavi Video Editor Crack + Activation Key [2025]
Movavi Video Editor Crack + Activation Key [2025]Movavi Video Editor Crack + Activation Key [2025]
Movavi Video Editor Crack + Activation Key [2025]
l07307095
The Future of Microsoft Project Management Tools - Connecting Teams, Work, an...
The Future of Microsoft Project Management Tools - Connecting Teams, Work, an...The Future of Microsoft Project Management Tools - Connecting Teams, Work, an...
The Future of Microsoft Project Management Tools - Connecting Teams, Work, an...
OnePlan Solutions

Hands-On AWS: Java SDK + CLI for Cloud Developers

  • 1. AWS Workshop AWS Fundamentals Hands On Sessions Meetu Maltiar 24th March 2025
  • 2. About Me I work as Software Engineer Technical Leader @Cisco Systems Bengaluru - I like to invest time on Technologies and Software Craftsmanship - Former Co-organiser BOJUG (Bangalore Open Java User Group) - I like to participate in and attending conferences and disseminate knowledge - I am passionate about: Cloud Computing, Functional Programming, AI/ML
  • 3. Getting Started Ensure you have AWS Free Tier account Ensure also that you have AWS cost anomaly detection setup Install Java 17, Maven, AWS CLI Install IDE like Eclipse/Intellj-IDEA Clone repository: git clone https://github.com/meetumaltiar/aws-workshop
  • 4. Workshop Architecture Review This workshop follows a modular, service-by-service approach: 1. Java SDK v2 for interacting with AWS programmatically 2. AWS CLI for scripting infrastructure 3. Capstone projects for building something functional Have a pattern in place that can help in future coding projects
  • 5. Modules Covered S3 EC2 Lambda API Gateway DynamoDB SNS SQS IAM CloudWatch CloudFormation RDS (with EC2 MySQL Client) Capstone Project (Full Stack Backend)
  • 6. Common Setup - AWS CLI + Java + Maven Java 17 Maven build with SDK dependencies AWS CLI con fi gured with aws con fi gure Code resides in src/main/java/com/aws/workshop Scripts lives in scripts directory
  • 7. What is Amazon S3 Simple Storage Service - launched 2006 Focused on General Object Storage on Cloud Big fi les, small fi les, media content, source code, spreadsheets etc Scalable, Highly Available, Durable, Supports integrations with AWS Useful in various contexts: Website Hosting Database Backups Data Processing Pipelines
  • 8. S3: Core Concepts Buckets: Container of objects we want to store within a certain namespace Objects: Content that we are storing within a bucket Access By URL: http://s3.amazomaws.com/<BUCKET_NAME>/<OBJECT_NAME> Programatically: We will see in code examples
  • 9. S3: Storage Classes Allows to reduce costs, but with reduced features Examples: Standard, Intelligent, Infrequent Access, Glacier Each tier has di ff erent pricing, latency, availability Standard Tier (Hot Data) > Infrequent Access > Glacier (Cold Data) Lifecycle Rules: Automate data movement process
  • 10. S3: Java Code Basics Create a client using builder pattern: S3Client s3 = S3Client.builder() .region(Region.AP_SOUTH_1) .build() Create a putObjectRequest using builder pattern: PutObjectRequest putObjectRequest = PutObjectRequest.builder() .bucket(bucketName) .key(key) .build(); Actual invocation to put an object in S3: s3.putObject(putObjectRequest, RequestBody.fromFile(new File(filePath)));
  • 11. S3: AWS CLI Navigate to src/main/resources/awscli/s3operations.cli // --- AWS CLI Commands for S3 Operations --- // 1 Create an S3 Bucket aws s3 mb s3://my-cli-s3-bucket // 2 Upload a File to S3 aws s3 cp file.txt s3://my-cli-s3-bucket/ // 3 List Objects in an S3 Bucket aws s3 ls s3://my-cli-s3-bucket/ // 4 Delete an Object from S3 aws s3 rm s3://my-cli-s3-bucket/file.txt // 5 Delete an S3 Bucket (must be empty before deleting) aws s3 rb s3://my-cli-s3-bucket --force
  • 12. AWS IAM Identity and Access Management Securely controls access to AWS services and resources Includes Users, Roles, Policies and Groups Critical for security of AWS Infrastructure
  • 13. AWS IAM: Java API Create IamClient by providing region: IamClient iam = IamClient.builder().region(Region.AWS_GLOBAL).build(); Create User using builder pattern: CreateUserRequest createUserRequest = CreateUserRequest.builder().userName(userName).build(); iam.createUser(createUserRequest); Attach ReadOnlyAccess Policy: AttachUserPolicyRequest attachPolicyRequest = AttachUserPolicyRequest.builder() .userName(userName) .policyArn("arn:aws:iam::aws:policy/ReadOnlyAccess") .build();
  • 14. AWS IAM: AWS CLI # 1 Create an IAM Role with Trust Policy aws iam create-role --role-name my-lambda-role --assume-role-policy-document file://lambda-trust-policy.json # 2 Attach a Managed Policy to Role (e.g., AWSLambdaBasicExecutionRole) aws iam attach-role-policy --role-name my-lambda-role --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole # 3 Attach an Inline Policy to Role (e.g., DynamoDB access) aws iam put-role-policy --role-name my-lambda-role --policy-name DynamoDBPutItemPolicy --policy-document file://dynamodb-putitem-policy.json # 4 Get Role Details aws iam get-role --role-name my-lambda-role # 5 List Attached Policies aws iam list-attached-role-policies --role-name my-lambda-role # 6 List Inline Policies aws iam list-role-policies --role-name my-lambda-role
  • 15. AWS EC2 EC2 are like virtual server on Cloud Key components: AMI, Instance Type, Security Group, key-Pair AMI (Amazon Machine Image) - Think of it as a blueprint for your instance - De fi nes OS, pre-installed software, volume storage and boot con fi g Instance Type: De fi nes hardware specs (CPU, RAM, Networking capacity) - Categorised by use-case: t2.micro/t3.micro (free tier eligible), c5.large (compute optimised), r5.large (memory optimised) - selecting right instance type is key for cost and performance needs
  • 16. AWS EC2: Continued Security Group - Acts like a virtual fi rewall for your instance - control inbound and outbound tra ffi c to EC2 - Rules are based on - Port (22 for SSH, 80 for HTTP, 3306 for MySQL) - Protocol (TCP/UDP) Source IP range (eg 0.0.0.0/0 means public access) Key-Pair - A public-private key is used to SSH in your instance - AWS stores public key and we download the private key (.pem fi le) - Without key we cannot SSH to instance after creation
  • 17. AWS EC2: Java API Build Ec2Client, provide region: Ec2Client ec2 = Ec2Client.builder().region(Region.AP_SOUTH_1).build(); Make RunInstancesRequest: RunInstancesRequest runRequest = RunInstancesRequest.builder() .imageId("ami-0c768662cc797cd75") // Amazon Linux 2 (Mumbai) .instanceType(InstanceType.T2_MICRO) .maxCount(1) .minCount(1) .keyName("my-key") // Replace with your real key pair .securityGroupIds("sg-my-security-group") Make RunInstances call: RunInstancesResponse response = ec2.runInstances(runRequest);
  • 18. AWS EC2: CLI # ----------------------------------------- # EC2 Operations via AWS CLI # ----------------------------------------- # 1 Launch an EC2 Instance (Amazon Linux 2 Free Tier Eligible) aws ec2 run-instances --image-id ami-0c768662cc797cd75 --instance-type t2.micro --key-name my-key --security-group-ids sg-06b8961f9dd1435fe --region ap-south-1 # 2 List All EC2 Instances aws ec2 describe-instances --query "Reservations[*].Instances[*].[InstanceId,State.Name,InstanceType,PublicIpAddress]" --output table --region ap-south-1 # 3 Stop an EC2 Instance aws ec2 stop-instances --instance-ids i-xxxxxxxxxxxxxxxxx --region ap-south-1 # 4 Terminate an EC2 Instance aws ec2 terminate-instances --instance-ids i-xxxxxxxxxxxxxxxxx --region ap-south-1
  • 19. AWS API Gateway Create RESTful API that triggers Lambdas Support custom domains, authentication, rate limits Works seamlessly with Lambda (AWS_PROXY) CLI Script: - create-rest-api, create-resource, put-method, put-integration - Adds permission and deploys
  • 20. AWS Lambda Serverless function hosting Triggered by events (API, S3, SQS, etc) Pay only by runtime duration Stateless and ephemeral
  • 21. AWS Lambda Java API public class LambdaHandler implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> { @Override public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent request, Context context) { context.getLogger().log("LambdaHandler invoked"); APIGatewayProxyResponseEvent response = new APIGatewayProxyResponseEvent(); response.setStatusCode(200); response.setBody("{ "message": " Hello from Java Lambda!" }"); return response; } } Implements RequestHandler, takes API Gateway event and returns JSON response
  • 22. AWS CloudFormation Infrastructure as code (IaC) Write cloud formation templates and call aws cloud formation: create-stack, delete-stack, describe-stacks Declarative YAML/JSON template AWSTemplateFormatVersion: '2010-09-09' Description: Basic CloudFormation Template - S3 + EC2 Parameters: KeyName: Description: EC2 Key Pair to SSH Type: AWS::EC2::KeyPair::KeyName Resources: MyS3Bucket: Type: AWS::S3::Bucket Properties: BucketName: !Sub "workshop-demo-bucket-${AWS::AccountId}" Automates creation of AWS resources aws cloudformation create-stack --stack-name "$STACK_NAME" --template-body "file://$TEMPLATE_PATH" --parameters ParameterKey=KeyName,ParameterValue="$KEY_NAME" --capabilities CAPABILITY_NAMED_IAM --region "$REGION"
  • 23. AWS DynamoDB NoSQL key value and document oriented database Fast scalable, managed and server-less Free Tier: 25 GB + 200M requests/month JAVA API: Use DynamoDBClient for create, put, delete operations. Works with table-name and primary-key CreateTableRequest request = CreateTableRequest.builder() .tableName(TABLE_NAME) .keySchema(KeySchemaElement.builder() .attributeName("studentId") .keyType(KeyType.HASH).build()) .attributeDefinitions(AttributeDefinition.builder() .attributeName("studentId") .attributeType(ScalarAttributeType.S).build()) .provisionedThroughput(ProvisionedThroughput.builder() .readCapacityUnits(5L) .writeCapacityUnits(5L) .build()) .build();
  • 24. AWS DynamoDB CLI REGION="ap-south-1" TABLE_NAME="Students" echo " Creating DynamoDB table '$TABLE_NAME'..." aws dynamodb create-table --table-name $TABLE_NAME --attribute-definitions AttributeName=studentId,AttributeType=S --key-schema AttributeName=studentId,KeyType=HASH --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 --region $REGION || true echo " Waiting for table '$TABLE_NAME' to become ACTIVE..." aws dynamodb wait table-exists --table-name $TABLE_NAME --region $REGION echo " Table '$TABLE_NAME' is now ACTIVE." echo " Inserting item into '$TABLE_NAME'..." aws dynamodb put-item --table-name $TABLE_NAME --item '{"studentId": {"S": "101"}, "name": {"S": "Meetu"}, "email": {"S": "meetu@example.com"}}' --region $REGION
  • 25. AWS SQS Queue based asynchronous messaging Pull model - consumers polls messages Used for decoupling micro-services and job processing SQS also has de-duplication queue settings to manage fail scenarios
  • 26. AWS SQS Java API Create SQS client: SqsClient sqsClient = SqsClient.builder().region(Region.AP_SOUTH_1).build(); Create Create SQS Request: // 1 Create Queue CreateQueueRequest createQueueRequest = CreateQueueRequest.builder() .queueName(queueName) .build(); String queueUrl = sqsClient.createQueue(createQueueRequest).queueUrl(); // 2 Send Message SendMessageRequest sendRequest = SendMessageRequest.builder() .queueUrl(queueUrl) .messageBody("Hello from SQS via Java!") .build(); sqsClient.sendMessage(sendRequest);
  • 27. AWS SQS CLI # SQS CLI Commands for MyJavaQueue # 1 Create Queue aws sqs create-queue --queue-name MyJavaQueue --region ap-south-1 # 2 Get Queue URL aws sqs get-queue-url --queue-name MyJavaQueue --region ap-south-1 # 3 Send Message (replace <queue-url>) aws sqs send-message --queue-url <queue-url> --message-body "Hello from AWS CLI to SQS!" --region ap-south-1 # 4 Receive Message aws sqs receive-message --queue-url <queue-url> --region ap-south-1 # 5 Delete Message (replace <receipt-handle>) aws sqs delete-message --queue-url <queue-url> --receipt-handle <receipt-handle> --region ap-south-1
  • 28. AWS SNS Pub/Sub messaging service Push based delivery to email, SMS, Lambda, HTTP Ideal for alerts, noti fi cations, fan-out scenarios Java code API: Create SNS client SnsClient sns = SnsClient.builder().region(Region.AP_SOUTH_1).build(); Create Topic request: CreateTopicRequest createRequest = CreateTopicRequest.builder().name(topicName).build(); Publish Message: // 2 Publish Message PublishRequest pubRequest = PublishRequest.builder() .topicArn(topicArn) .message("Hello from AWS Java SNS!") .build(); sns.publish(pubRequest);
  • 29. AWS SNS Script # 1 Create SNS Topic echo " Creating SNS topic '$TOPIC_NAME'..." TOPIC_ARN=$(aws sns create-topic --name $TOPIC_NAME --region $REGION --query "TopicArn" --output text) echo " Topic created: $TOPIC_ARN" # 2 Publish initial message echo " Publishing welcome message to SNS..." aws sns publish --topic-arn $TOPIC_ARN --message "Hello from AWS CLI SNS Script!" --region $REGION echo " Message published to $TOPIC_NAME." # 3 Subscribe email echo " Subscribing email: $EMAIL" aws sns subscribe --topic-arn $TOPIC_ARN --protocol email --notification-endpoint "$EMAIL" --region $REGION echo " Confirmation email sent to $EMAIL. Please confirm from your inbox." # 4 List all topics echo " Listing all topics:" aws sns list-topics --region $REGION
  • 30. RDS + EC2 MySQL Client Amazon RDS is relational database systems on AWS RDS has support for PostGres, MySQL and is well managed Backup, patching, replication are handled by RDS CLI scripts: - rds-script.sh for launching MySQL instance with VPC security group - rds_ec2_testsetup.sh: Launch EC2, install MySQL, connect to RDS
  • 31. Capstone Project: Student Submission Portal Stack Includes: Lambda (Java) API Gateway (POST /submit) DynamoDB (store submission) SNS (notify admin) Java Code Walkthrough StudentSubmissionHandler.java: Reads request saves to DB sends SNS Structure src/ main/java/com/aws/workshop/capstone/ StudentSubmissionHandler.java model/ service/
  • 32. Capstone Project Cleanup Scripts: cleanup_all.sh: Tears down all major resources cleanup_rds_ec2.sh: Deletes RDS + EC2 setup Tips: Con fi rm SNS and DynamoDB deletions Check S3 buckets and CloudWatch logs if needed
  • 33. Next Steps & Learn More Explore CloudTrail, VPC, EKS, EventBridge Try Terraform + AWS Dive in serverless best practices