Cloud Computing
The practice of using a network of remote servers hosted on the Internet to store, manage, and process data, rather than a local server or a personal computer.
Types of cloud
Benefits of Using AWS over traditional data center
Accessing AWS services
AWS global infrastructure (Regions and AZs)
IAM
Elements of IAM
Creating an IAM user
Step 6 : Attach administrative policy for the user
Step 7 : Hit the Create user Button
Note down all the details for user login and download the .csv file
Login with the newly created user
Exercise 1
Elastic Compute Cloud (EC2)
Important aspects of EC2
Pricing for EC2
EC2 instance life cycle
AMI (Amazon Machine Image)
Creating an EC2 Instance
Step 1: Login with the previously created user and on the home page search bar search for EC2
Step 2: You will be landed to the screen below, hit the Launch Instance
Step 3 : Click on browse more APIs Select ubuntu server AMI instance which is Free tier eligible
Step 4 : Choose the free tier instance type and hit
Next : Configuration Details
Create new pem file by clicking on Create new key pair
Edit network settings
Step 7 : Add custom TCP rule for port 8080 and open it for outside world and Click on Launch
You can see now instance in up and running
Connecting to EC2 instance type
Place the line below in application.properties spring.application.name=Spring Application on EC2
Now hit http://<IPV4-IP>:8080/
Change Instance Type
Creating AMI
Terminate Instance
Exercise 2
Introduction to Elastic Block Store (EBS)
EBS is an AWS block storage service, that provides block level, persistent storage volumes for EC2 instance
Snapshot
Create the new Instance from AMI
Adding Volume to an instance and launch the instance
In the volume Section you will see two volumes attached to NewInstance
You will observe that the jar we created earlier is already on thew instance
Run the jar and try to access the app over public IP
Connect to the instance using pem file
Hit the command below You will be able to see the attached EBS
Modify the volume
Detach Volume
You cannot detach root volume when instance is running
Try Detaching the volume other than root
Delete the volume which is detached
Lets create a file in the New Instance
Create the snapshot of the root volume of new instance
In the Snapshots section you will see your newly created Snapshot
Create new volume from the snapshot
While creating the volume from the snapshot please make sure that you select the availability zone of the instance and Volume should be same
In the volume section you will be able to see newly created instance from Snapshot
Launch a New Instance from AMI with only root volume
Connect with the instance and see its content
stop the AnotherInstance
Detach the root volume of AnotherInstance
Attach SnapShot Volume to Another Instance
Start the AnotherInstance
Now Check the AnotherInstance you must file file.txt file there
Exercise 3
Elastic IP
Whenever we restart the instance the public IP of instance changes and we need to use the changed public IP in order to connect with the instance we can avoid this by using elastic IPs.
Connect to instance using elastic IP and start the Spring Boot App
Access App Using elastic IP
Now if you restart the instance again you will see that you will be able to connect with the instance using same elastic IP
AWS for Java Developers part-2
Elastic Load balancer
Command to trigger
java -jar spring-ec2-0.0.1-SNAPSHOT.jar --spring.application.name=instance-2 &
java -jar spring-ec2-0.0.1-SNAPSHOT.jar --spring.application.name=instance-1 &
Now try hitting the the public DNS for the load balancer and you should be able to see response from both the instances
Auto Scaling
API gateway
An API gateway is an API management tool that sits between a client and a collection of backend services. An API gateway acts as a reverse proxy to accept all application programming interface (API) calls, aggregate the various services required to fulfill them, and return the appropriate result.