Almost every organization is taking a step closer to the cloud. Reason is obvious - To avoid upfront infrastructure cost and to avoid maintenance cost. Cloud Computing has changed the way Java Software Development companies used to work. Decades before, companies had to spend millions to set up their infrastructure but gone are those days with the advent of Cloud.
Java in Cloud Computing is on-demand availability of machines and storage at a very affordable price and with no maintenance cost. Many known brands have entered into this space to leap the benefit such as Amazon, Azure, Google and Alibaba.
EC2 - Elastic Cloud Compute Definition
EC2 is a web service provided by Amazon to create machines on demand in Amazon cloud.It provides full control to choose.
Operating System:
You can choose any OS such as Windows, Linux, and Unix etc.
Memory:
You can configure memory that should be attached to your EC2 machine/instance as per your requirement.
CPU Cores:
You can also choose how many core CPU you need, In addition, if you need any GPU card for gaming platforms & image processing.
IP Addresses:
You can set up your own virtual cloud and can define the range of IP addresses that can be used for your EC2 instances.
Traffic Control:
You can control incoming as well as outgoing traffic from your EC2 machines by allowing & restricting traffic protocols.
WHY NEED EC2?
SECURE
AWS provides robust security in their data center and follows strict privacy guidelines. So relying on Amazon cloud for infrastructure needs is absolutely stress free.
SCALABLE
You can increase or decrease from one to hundred of machines in minutes. AWS also provides an auto-scaling group with EC2 that can scale up and scale down your machines as per configuration provided by you.
COMPLETE CONTROL
However, the machines are actually present in Amazon Data Centers but still you have complete control of your instances. You will have root access to interact them, to install any packages on them, to stop or terminate them at any moment
LOW COST
AWS adopts the pay as you use model, which makes it very cost effective since you will pay only for resources that you use.
RELIABLE
Even in case of any hardware failures, your EC2 machines will be replaced rapidly with healthy machines.Amazon guarantees 99.99% availability for each Amazon EC2 Region.
How AWS Services Associated with EC2?
SECURITY GROUP
You can control the incoming and outgoing traffic to your EC2 instance using Security group.You can configure what kind of traffic can access your EC2 instance such as SSH,HTTPS,TCP etc.Moreover, you can also configure from what IP addresses that traffic can come.
ELASTIC LOAD BALANCER
As the name suggests, Elastic Load Balancer automatically distributes incoming application traffic across multiple Amazon EC2 instances to increase Availability & to decrease response time.
PLACEMENT GROUP
However, you have no control of EC2 hardwares directly but still you can configure how your EC2 instances should be placed with respect to each other using a placement group. Placegroup group defines the strategy of placing EC2 instances.
Using them you can define whether you want your EC2 instances to be placed on the same hardware to enjoy higher network bandwidth and lower latency or you want your EC2 instances to be placed on separate hardware in different physical locations to provide fault tolerance and high availability.
VIRTUAL PRIVATE CLOUD
You can also configure your private network over cloud to launch your EC2 instances and other resources inside it. VPC provides you flexibility to choose your own IP addresses and to configure route tables and many other things.
Auto Scaling Group
Auto scaling groups can automatically scale up and scale down your EC2 instances. You can define the minimum instances, maximum instances and desired instances for your application. So whenever your instances fail or crash due to any reasons, the Auto scaling group will make sure that the minimum number of instances are always running by launching fresh EC2 instances and whenever incoming demand increases, the auto scaling group will launch more instances upto number of maximum instances configured to meet that increasing demand.
Elastic Storage Block
Amazon Elastic Block Store (EBS) is a block storage that can be attached with Amazon Elastic Compute Cloud (EC2).It is just like a virtual harddrive that can be attached and detached from EC2 instances and can even be attached from one EC2 instance to another.
Launching Your First EC2 Instance
In order to launch your first EC2 instance, you have to sign up to AWS using this link https://signin.aws.amazon.com/. Amazon provides 12 months of free tier in which you can enjoy many of the services free of cost upto 12 months.
-
Step 1: Go to EC2 Console
After you sign in to your aws account. To get started with EC2 you can go directly to this link console.aws.amazon.com/ec2 or you choose EC2 under the Computing Section in Services Tab. Once you are redirected to EC2 Console, click on “Launch Instance”.
-
Step 2: Choose AMI
In the next step, you have to choose specific AMI. AMI is an Amazon Machine image, which defines what kind of machine will be launched. What will be the operating system, what all packages, tools, databases etc will be pre-installed on the system. Choose any AMI (choose free-tier eligible for demo purpose) and click on “Select”.
-
Step 3 : Choose EC2 Type
In the next step, you have to choose the Ec2 instance type that dictates CPU cores, memory, storage type, network performance and IPV6 support. There are different EC2 family types for different application needs such as t2- For General Purpose applications, C5- for Compute Intensive workload, M5- memory intensive applications and many more.
To learn more about Ec2 instance type, check this link https://aws.amazon.com/ec2/instance-types/. Once you select the Ec2 type click on “Configure Instance details”.
-
Step 4: Configure EC2
In this step, you have to define how many number of instances you want to launch, what will be VPC and subnet in those instances will be started, define placement group, and whether you want to install spot instances.
Spot instance is a cheap alternative, if your application is stateless and can be stopped any time then you can choose spot instances to save more. There are other options as well but you can keep them default and click on “Next: Add Storage”.
-
Step 5: Add storage
In this step, you can add additional storage (ESB) with the instance. By default, our instance will have 8 GB of storage attached. Click on “Next: Add Tags” to proceed further.
-
Step 6: Add Tags
This is an optional step in which you can add some metadata with your Ec2 instance as a key-value pair that defines your instance. After adding tags, click on “Next: Configure Security Groups”
-
Step 7: Configure Security Group
In the next step, you have to define a security group, which will define the incoming and outgoing traffic to/from our EC2 instance. You can add any number of rules and can define the IP addresses that can access our EC2 instance. Click on “Review and Launch” for the final step.
-
Step 8: Review & launch
In the final step, click on Launch.
-
Step 9: Download SSH Keypair
Select “Create a new key pair”, provide some name to it and Download SSH key pair. This will be used to access EC2 instances using some SSH tool.
Conclusion
EC2 service provided by Amazon is undoubtedly the fastest, scalable, secure and flexible way to launch machines in no time. Software application development Company no longer need to worry about infrastructure since Cloud Computing is providing everything to them at price like never before.