Hi, my dear friend! Today we are going to start the great path to learning cloud systems.
I'll try to do my best that describe in smallest details the process of moving to AWS of your application or creation new one. So, let's get it started.
This post implies the existence of account on Amazon.
Overview and objectives
Before we start the installation of our instances on AWS we need to clarify a lot of definitions which will be using on this post, that we do not stop on describing each of them.
- it's information resources (it can be anything, VM, Storage, Database etc.) which can be managed and used with minimal effort, often over the Internet.
(Amazon Web Services) - the company which provides access to cloud resources for use.AWS technologies :
- EC2 - Amazon Elastic Compute Cloud (virtual machine)
- S3 - Amazon Simple Storage Service (storage)
- RDS - Amazon Relation Database Service (relation database)
- EBC - Amazon Elastic Block Store (block level storage volumes for use with Amazon EC2 instances)
- CloudWatch - Amazon monitoring system
- ElasticIP - Amazon Static IP address
- ElastiCache - Amazon fully managed in-memory data store and cache service
- ElasticLoadBalancer - Amazon service for load balancing and redirecting traffic
The main objective of this post will be the creation of instance and database on AWS and configure monitoring to them.
First steps on AWS and launching of services
Like the first step, let's review the main page of Amazon console.
A little hint, before you start the launching of services, choose needed for your region, where your services will be stored.
The start of our journey will be from defining of IP address which will be assigned to our EC2 instance. To do this, go to the EC2 service and in "NETWORK & SECURITY" tab, click on Elastic IPs. And after clicking of the button "Allocate new address" you will see on your list of Elastic IPs your record.
The next step will be launching of VM and assigning to it our new IP.
To launch an instance, go to "Instances" tab and press "Launch Instance" button. And in the first step of creation, you need to choose OS for your machine. The second step gives you the possibility to choose instance type. Do your choice based on needed performance and requirements of your application. The step 3 and 4, please choose due to your requirements, also. On step 4, please carefully set needed for you, storage. Step 5 gives you the possibility to assign tags to your instance, which will be useful when you have a lot of services on AWS. If it's your first node, you can skip it. And I want to make attention on step 6 "Security Groups".
All services inside AWS are working due security group which assigned to it. AWS Security groups give you the possibility to allow or deny connections to your services from outside or inside of the network. In general, it looks like IPtables, table of addresses and ports due which is working network on the instance. As like we want to launch instance with public IP and connected to RDS, so please create new security group and add to list ports: 80 (http) and 3306 (mysql).
And before launch in the final step of the instance, you need to choose the SSH key for connection to your new instance. You can auto-generate it via Amazon or choose existing one.
If you want to create SSH keys by yourself, you can use this official manual SSH communication security
The new instance you can find on instance list.
Until then that the instance in pending state, we can assign to it Elastic IP, which one we have created before. To do this, select the VM and click on "Action" button, "Network" and "Manage IP Addresses", select created elastic IP.
The almost same steps need to do for the launching of our database.
Choose needed options and provide credentials for you DB and you will see the new database on your console. Only one thing, on "Security group" tab, select your new group to availability it from your EC2.
And now we came to step of monitoring on AWS.
When we have created any services, Amazon automatically is running the monitoring on them of few default metrics. This metrics we will review and also will create the dashboards to easier of the monitoring process.
In this will help us the management Amazon tool, "CloudWatch".
There you can find a lot of tabs, so let's review one by one them. And like the first step, you can go to tab "Metrics".
On this tab, you will see all metrics which are collecting from your services on Amazon and using needed filters, you can create needed graphs for the view. But for more comfortable using, Amazon provides "Dashboards", where we can generate and choose needed for us graphs on one screen.
Like for example on the screenshot below, you can see dashboard "Mine-EC2" with three graphs, which one I have created due to metric types.
It's pretty much easy, you just create the dashboard and assigned to it needed graphs.
It is very useful, that you can create one dashboard for your all application and watch on them when it will be needed.
Amazon also provides for customers possibility of notification when is something going wrong. And for this target also will help "CloudWatch". Let's review a little example.
Just imagine, that we need to get the notification when CPU utilization load is going up on servers. It's very important, cause due to this our application can be working slowly or even at all can crash. So we need to have email notification in this case.
Click on "Create Alarm" and choose needed parameters. For example, I have created Alarm on CPU Utilization of my instance. This check will be running every minute and if the value will be more than 1, I should receive the email message. Let's check it.
Of course, if we want to check it, we should make some load on our VM. And help on it can command
dd if=/dev/zero of=/dev/null
After running it, we should notice that CPU utilization load is going up and the alert system should set it to the warning state and after send an email with critical status.
Nice, warning state has been set. Wait one more minute.
Awesome! Our alert is working and I have received an email regarding this issue.
Also, Amazon provides not the less useful function of events. Amazon Events has provided for us to assign some action on some incident.
And of course example, we need to create the rule on the event, when the instance is going to shut down or stopping, the event should try to reboot this instance and maybe it will save us from long downtime.
Click on "Create rule" button and fill the needed form.
On next page set the name and give permissions on this action.
And here we go. We received needed event.
Now we're finished chapter related to monitoring on AWS. The one thing that we did not review this post, it's logging system of AWS, but it will be on next post of Amazon services.
Thanks, everyone to join us, it's very cool that we can learn and develop together. I hope this information was useful for you.