AWS Services
There are a range of about 130+ services in AWS and we can categorize them into different types of subparts like,
- Compute and analytics services
- Storage and Databases services
- Network and management services
- Application and development services
Compute Services
Compute services help developers to build, deploy, and scale an application in the cloud platform.
Some examples of Compute services are EC2, Lambda, Elastic Container Service, Elastic load balancer, Elastic beanstalk.
EC2: It is a web service that allows developers to rent virtual machines and helps to resize the compute capacity.
Lambda: It is a serverless compute service. it is also responsible to execute code for a specific application.
Configuring an Ec2 Instance
- Go to AWS console.
- Type EC2 on the search bar and select the Ec2 Instance option.
- Make sure that you select the appropriate region.
- On the EC2 page, console click on the launch instance option.
- It will be redirected to select an AMI which stands for Amazon Machine Image and select the appropriate Image.
- The AMI image will be Software that will be launching on the server.
- After selecting we will be redirected to select the type of the instance.
- The type defines how powerful your machine and how many VCPUs we need and how much memory do we need.
- After selecting type click on the Configure Instance Details button to review and adjust the parameters of the instance.
- On the configuration page, you will see so many options, like the number of instances, Network, Subnets, public IPS, etc.
- On the Network Option, a default VPC will be selected for you if you want you can create another one and can attach that.
- Subnet option gives you the list of availability zones where your Instance needs to be hosted select the desired one.
- At the bottom, there is a button named add storage click on the add storage button.
- There will be a default root storage available on that page that hosts your operating system disk space. If you need more storage click on the add new volume button below and add a disk to have more storage for the files.
- On the bottom, there will be a button called Add tags click on Add Tags.
- Tags are basically key-value pairs that allow you to identify the instance and classify it.
- you can assign the desired tag name and value to your instance.
- On the bottom, there will be a button named configure security group click on that button.
- This is basically a firewall for your web instance, we can add the rules and configure them like windows use RDP and Linux uses SSH, etc.
- At the bottom, there will be a blue button indicating review and launch click on it.
- Review all the parameters you configured and click on the launch button which is located at the bottom.
- After clicking the launch button you are prompted for a key pair, It is basically an access assigning tool.
- Click on the create keypair option and name it and click download key pair.
- A PEM file containing keypair will be downloaded and after that click on the launch instance button.
- On your EC2 dashboard, you will see your instance up and running with your desired parameters.
Setting up Security Groups
While creating an Ec2 instance under the section of configuring a security group there will be an option to choose a security group or create one.
When we select the choose an existing security group there will be some default security group which evolves under the names of default and Open ports.
When we select the Create new security group option we can define the rules like ports of incoming and outgoing traffic, type of the port, protocol, and source whether it is custom Ip or default, Ip, or anywhere.
Elastic IPS
Elastic IPs are nothing but a static IP that is allocated to your EC2 instance.
The elastic IP is associated with our AWS account and not with an EC2 instance.
At any point, we can associate IP with another EC2 instance. A static IP or an Elastic Ip is needed to have a valid URL or an Ip address if the instance is restarted.
Using EC2 to deploy applications
The best way to deploy applications in AWS using EC2 is by using amazon code deploy.
- On the AWS console in the service menu or in the search bar go for S3
- create a bucket in the S3 service and upload the folder containing your website file ( your website files).
- Create the bucket with all the requirements and upload the folder containing codes.
- Go to your bucket select the bucket and click on the edit public access setting.
- If you want your bucket to be public click all checkboxes and confirm the bucket name and click save.
- after that click on bucket and click on the folder uploaded and at the upper part you will see a button named actions.
- Click on actions and select the folder make public.
- as a next step go to your EC2 console and create an EC2 instance.
- While adding tags in EC2 make sure you add HTTP and HTTPS tags also and launch the instance.
- After the instance has created SSH into the instance by using its public IP.
- After entering into the EC2 through SSH update your instance using the command yum update -y
- after updating your EC2 instance use the command yum install httpd and enter to install apache server.
- change the directory of the user to root to have your folder placed.
- after changing the directory we need to copy the folder from our S3 bucket to the EC2 instance.
- To get that type the command i.e wget (object URL in your S3 bucket) and enter
- now our folder containing codes is in the EC2 instance and move them to the root directory by using the MV command.
- Now start the HTTP service by using the command service httpd start.
- Now we go to EC2 instance and copy the Public Ip of the instance and pate it in chrome and press enter.
- And you can see the result of the code.
Assigning EBS volumes
Aws EBS ( Elastic Bean Store) is block storage which is very similar to a normal drive that you can attach to your server.
To create an AWS EBS
- Log in to the AWS console and search for EC2 in the search bar.
- Click on the volumes option under the elastic block storage.
- Click on create volume where you can choose volume type, size, and IOPS.
- Click create.
- Go to volume dashboard click on the created volume and right-click on it and click attach the volume.
- A new dialog box opens which asks you to select the instance to which it should be attached.
- Give the name of the device as /dev/SDF or newer Linux kernels can be changed to /dev/xvdf
- click attach.
- To check whether it is attached or not SSH into the instance in which you have attached and type the command lsblk.
- There you can see the attached volume.
Snapshots
Snapshots are incremental backups.
Incremental backups mean that only the block on that device that has changed after your most recent snapshot are saved.
Each snapshot contains all the information that is needed to restore your data to a new EBS volume.
We can backup the data on Amazon EBS volumes to Amazon S3 by taking point-in-time snapshots.
Point In time refers to a given point of time where you can backup your data on your AWS.
Incremental backups minimize the time required to create the snapshot and save the storage costs by not duplicating data.
When you delete a snapshot only the data unique to that snapshot is removed.
snapshots are stored in AWS S3.
AMI’s and creating a new AMI
AMI stands for Amazon Machine Image, There are plenty of AMI’s that are maintained by amazon and other communities, and also one can create their own AMI for their work purpose.
It is basically an operating system that we create and launch instances based on the image.
- sign in to the AWS console and navigate to the EC2 service.
- Create an Instance and after creating the instance select it.
- After selecting it you will see an option called actions click on it.
- Click on the image option on the scroll down bar of the Actions button.
- click on create Image.
- You will get a pop-up window asking for image name, description, and reboot options, and Image volumes.
- Click and fill in the required parameters and click Create Image.
- Now on the EC2 dashboard under the Images section click on AMI.
- you can see that your image is being created with your required parameters.
- Creating an AMI will auto-create a snapshot for the Image.
- To check that click on the Snapshot under the EBS section and make sure that the snapshot is created.
- Go to the EC2 dashboard and click on launch instance.
- Under the Choose AMI section click on My AMIs.
- Select the AMI you have created and create an instance.