INTRODUCTION TO AWS LAMBDA

In this module, we will learn about what is AWS Lambda and Amazon CloudWatch and how we are using it in AWS Management Console. We will create AWS Lambda S3 event function, configure and also upload files to that event and monitor those using Amazon CloudWatch.

WHAT IS AWS LAMBDA AND AWS CLOUDWATCH?

AWS LAMBDA: – this is a computer service which is provided by Amazon to runs code in return to events and manages computer resources which will be easy to built applications. It will respond very fast to the events like image upload, in-app activity, and website click. we can also create back end services where computer resources are automatically triggered based on requests.

AMAZON CLOUDWATCH: – this is a monitoring service which is provided by Amazon to monitor all applications and AWS cloud resources that we run on AWS. This will also collect files and alarms, and also it will monitor EC2 instances based on custom metrics which are set by applications and services.

HANDLING S3 EVENTS USING LAMBDA CONSOLE

We will create an S3 bucket and configure it as Lambda event source management. Then we will test the functionality by uploading the files and monitoring them.

Step 1. Go to services and type “S3” and we will create a bucket. If you are not sure how to create the Bucket you can refer the module “INTRODUCTION TO SIMPLE STORAGE SERVICE (S3)”

Step 2. Create the bucket with some unique name and set the region to which we are using from the start.

Step 3. After creating the bucket we need to create S3 Lambda function.

CREATING S3 LAMBDA FUNCTION

Step 1. Go to services and type “Lambda” we can see on the Lambda dashboard there are a lot of services which will vary according to our users. But since we are creating S3 Lambda functionality when we scroll down we will see s3-get-object-phyton blueprint.

 

L

Figure 1. Selecting Blueprint

 

Step 2. then on the next page it will ask us to link to the S3 bucket which we created just select that bucket and Event type select Object Created (ALL) this will include all the creation functionality like PUT, POST, COPY etc. And make sure to enable trigger option at the bottom to get triggers of this S3 bucket. Then click “Next”

L-1

Figure 2. Configuring Triggers

Step 3. In this page, we need to configure its functions like Name, Description, and Runtime which defines the coding platform like phyton. In code, entry Type select Edit code Inline which will give us a sample code that can be edited. but as of now, we will leave like it is. Below when we scroll down we can see Lambda function handler and role here we will select the custom role in role tab. This will direct you to IAM page and here we can create the role and save. That role will be added here.

 

 

L-2

Figure 3. Configuring Functions

 

Step 4. Below we will have Advanced settings which will show memories and all details. Then Click Next and review after that again click Next.

Step 5. Open S3 bucket which we linked to lambda and upload files.

Step 6. then again come back to Lambda console we will see the function we created select that and then in here we will have monitoring option at the last. click on that and we will see graphs which will show us monitoring of that S3 bucket we have created.

This slideshow requires JavaScript.

Step 7. To view this in CloudWatch we can click on View Logs in CloudWatch where we can see a file under log groups that the event that was monitored in our S3 bucket using Lambda.

CONCLUSION

We learned what is Lambda and CloudWatch, how we create an S3 bucket and link that bucket to Lambda function. We also monitored the data in our S3 Lambda bucket using CloudWatch.

 

INTRODUCTION TO RELATIONAL DATABASE SERVICE (RDS) (WINDOWS)

In this module, we are going to learn about what is Relational Database Service (RDS) and how we are going to use it in Windows Instances.

WHAT IS RELATIONAL DATABASE SERVICE?

This is a web service which will help us to create a database in the cloud. There are many services with which we can create this data base like MySQL, PostGRE, Oracle etc.

CREATING RDS INSTANCE

This instances will be based on many platforms but will see the basic and most popular MySQL platform.

Step 1. Go to Services and enter “RDS” this will direct us to RDS Dashboard. We will Find “Launch Instances” Click on that.

Step 2. Here in this, we will select which platform we are creating our database, we will be using MySQL platform so select “MYSQL LOGO” in the left Navigation Bar.

 

RDS

Figure 1. Selecting the platform 

 

Step 3. In the next page, we need to enter all the details of our DB Instance, leave everything as default expect the DB Instance Tab select the type of instance we want for this MySQL instance. At the bottom we find Settings here we need to enter all the details asked to get connected to MySQL instance. Don’t get confused between MySQL and EC2 Instances. After that click “Next”

 

RDS-1

Figure 2. Configuring RDS

 

Step 4. Select the VPC, Subnet and Security groups based on your requirements. Enter the database name any name as we wish. And when we scroll down we will see Backup Retention which will define the backup time like how many days we need to do a backup and below is the place to store our backup. And then click “Launch Instance”

 

RDS-2

Figure 3. Configuring Advanced Setting 

 

Step 5. It will take 4-5 minutes to create the instance, then after that, we will get a URL across ENDPOINT tab. Copy that URL, this will connect our MySQL instance in our EC2 instance.

Step 6. Open the EC2 Instance Windows Server and connect it to Remote Desktop Protocol using port 3389 and after the instance opens go to MYSQL workbench and go to Database>Manage connections and type the details which we created above password and user name. This will take some time and connects to the MYSQL database which we have created. That’s how we create a database using MySQL instance.

CONCLUSION

We have learned what is Relational Database Service and how we create MySQL instance using RDS and connected it with EC2 Instance to view MySQL instance.

 

INTRODUCTION TO AWS CLOUDFORMATION

In this module, we will learn about AWS CloudFormation and create WordPress Cloud using Stacks in AWS Management Console.

WHAT IS AWS CLOUDFORMATION?

This will provide a good way for creating and managing all the AWS resources for developers and system administrators. We can create our own templates and can also use AWS sample templates which make flexible. We will be able to run our applications irrespective of our where the resources come from which will be provided by AWS. You can deploy and update the template and its associated resources which are called stacks by using AWS Management Console.

CREATING A STACK

Stacks are the collection of resources which we will be creating step by step

Step 1. Open Services and search for “CloudFormation” Service. We can find “Create New Stack” and also we can create Multiple stacks by clicking this “Create Stack Set”.

 

CF

Figure 1. Creating Stack

 

Step 2. Here we will have the option to create our own template or choose from existing templates, to design templates we need to know SQL coding, for this demonstration we will use already existing templates like WordPress Blog etc.

 

CF-1

Figure 2. Selecting the template

 

Step 3. In the next page we need to fill all the details of the stack, since we are using WordPress Template we need to create the user and password for WordPress here. For security, we can add KeyName which we have created before.  We need to select the instance type here to get the WordPress blog working over that instance.

 

Step 4. After 3-4 minutes the stack status will change to Create_Complete then below we will find many options just click on Outputs here we can find a URL which will direct us to WordPress.

This slideshow requires JavaScript.

Step 5. Complete all the details in WordPress and we can view the WordPress Main page and now we are ready to work with WordPress. That’s how we store our template and link them using AWS Cloud.

DELETING THE STACK

Select the stack we want to delete and go to “Actions” at the top and Select “Delete Stack” and it’s done.

CONCLUSION

We have learned what is AWS CloudFormation and also we Created a Stack of WordPress template and deleted that stack.

 

INTRODUCTION TO AMAZON ELASTIC LOAD BALANCING

In this module, we will learn what is Amazon Elastic load balancing and how we are going to implement in AWS Management Console.

WHAT IS AMAZON ELASTIC LOAD BALANCING?

This is a service which automatically balancing the loads by distributing the load across EC2 Instances. It will help us to avoid fault tolerance and also balances the load of the application traffic which is coming from outside. It will also detect the unhealthy instances and will automatically reroute to healthy instances until unhealthy instances get repaired. People can use Single Availability Zone or multiple Availability Zones to distribute the load across different locations.

CREATING ELASTIC LOAD BALANCING

We are creating load balancing between EC2 instances and also can link it with our Virtual Private Cloud to make it more effective in application tires.

Step 1. Go to “EC2” Service and in that from the left navigation bar select Load Balancers and Click on “Create Load Balancer”

Step 2. We have 2 types of load balancers- Application and Classic load balancer. We are going to use Classic load balancer because we are creating the simple load balancer.

 

LB

Figure 1. Types of Load Balancers

 

Step 3. We need to name this load balancer, and we can also select whether its internet facing or internal in Scheme this will help when we create the load balancer when the traffic is coming inside the network. Check for the Availability zones and VPC to allocate this load balancer to that particular Subnet and select he availability zone which is same as our EC2 Instances. We need to select Two Subnets because load balancers have minimum two interfaces each in a different subnet.

 

LB-1

Figure 2. Configuring Load Balancer

 

Step 4. Click “Next: Configure Security Settings” here it will show some warning that it’s not securely connected to the listener to make this secure we have to add SSH port 22 to the previous page. Then Click “Next: Configure Security Groups” select the security groups which we need for this load balancer or can create a new one.

Step 5. Click Next and we can see Configure Routing, we don’t have any routing groups of we will create a new targeting Group to make sure all the traffic will route to that group. Fill all the details of the Targeting Group. We also have protocols, make sure you always use a secure protocol like HTTPS.

 

LB-2

Figure 3. Configuring Routing 

 

Step 6. Click Next and we can see Register Targets here we need to add our EC2 Instances to connect this Load balancer. And then Click Next to Review and that’s it load balancer is created.

Step 7. To run this load balancer, after 10-12 minutes we can see the DNS link below copy that link and if you paste it in your Internet browser we can see that load balancer front end. We can see two instances running in our load balancer.

CONCLUSION

We learned about Amazon Elastic Load Balancer and how to deploy it in our AWS Management Console.

 

INTRODUCTION TO AMAZON DYNAMODB

In this module, we will learn what is Amazon DynamoDB and how we are using this in AWS Management Console. We will create a DynamoDB table, loading data to that table, querying DynamoDB table and deleting the DynamoDB table.

WHAT IS AMAZON DYNAMODB?

This is a NoSQL database which is fast and flexible created by Amazon. There is very less latency when we use Amazon DynamoDB for our database services. This supports both documents and key value data models. It is used in Creating mobile applications, the web, gaming, ad-tech, Internet of Things, and many other applications.

Let’s learn how to use Amazon DynamoDB in AWS Management Console.

CREATING DYNAMODB TABLE

We need to create a table to store all the database of the application for that we need to follow these steps:

Step 1. Go to services and type “DynamoDB” and then click on “Create table

Step 2. We need to give the Name and Primary key to label this table. Under Primary Key, we need to select String because we are using alphabets after primary key if you want a number we can select that. Click “Create” at the bottom.

DDB

Figure 1. Creating Table

Step 3. After the table is created we can now edit the table by selecting the table we created. We will have many subtitles in that table like an overview, items, metrics, alarms etc. To add content to this table we need to select Items.

Step 4. Click on “Create Item” this will pop-up a window and contains coding as we said this is NoSQL coding so its simple to use. Artist is the Primary key we have created and we have String where we need to label the artist like SANJAY. Then Click Save.

DDB-1

Figure 2. Creating Items

Step 5. Similarly, we can add as many columns as we want to be based on our requirements just click on the item we created, and we a + sign in the first row if we select that we will get a drop-down menu in that select Append to add a new row. We can again select any type as per our requirements like Binary, Number etc. We can add any number of rows based on our requirements.

DDB-2

Figure 3. Adding New Append

Step 6. We can create any number of tables. just repeat the whole process again and again.

MODIFYING THE TABLE

In some cases, we need to change the table information is very simple to do that

Step 1. Select the table you want to modify and go to items, select the items we need to modify and we will get the code we have created before. We can edit as many times as we want.

QUERYING THE TABLE

If we have many items in the table it will be very difficult to find the item we want so we can use query option in DynamoDB to find that particular item

Step 1. Go to the Table we created and select Items, here we can find a drop-down menu which contains scan and query both.

Step 2. We can also add more filters to find the detailed view of our item by clicking +Add Filter.

DDB-3

Figure 4. Querying the table

Step 3. After filling all the details click on “Start Search” which will start to search for the filters which we have assigned before from all the items and shows us the required items.

DELETING DYNAMODB

For some cases, we need to delete the Table, Select the table and we can see on the top “Actions” Click on that it will drop-down a menu select Delete Table and all the items in that table will be deleted.

CONCLUSION

We have learned about Amazon DynamoDB and also how we create, modify, delete Amazon DynamoDB table.

 

INTRODUCTION TO AMAZON ELASTIC COMPUTE CLOUD (EC2) WITH WINDOWS SERVER

In this module, we will learn how to create EC2 instance for Windows Server. In “INTRODUCTION TO ELASTIC COMPUTE CLOUD(EC2)” module we have learned how to create EC2 Instance for Linux system, all the details of EC2 are in this module. Here we will just learn how to create an instance for Windows Server step by step.

Step 1. Go to Services and type “EC2” and we will see EC2 dashboard as we learned how to create an instance for Linux all the steps are same as that (we can refer to — “INTRODUCTION TO ELASTIC COMPUTE CLOUD (EC2) module”).

Step 2. Click on “Launch Instance” and scroll down so that we can see “Microsoft Windows Server 2016 Base” and select this, now we are installing Windows server in our Instance.

EC2W

Figure 1. EC2 Instance using Windows Server 2016

Step 3. Select the Instance Type based on your requirements and click “Next: Configure Instance Settings” and select all the details based on our requirements. Select the network as our Created VPC network.

Step 4. After completing Click “Next: Add Storage” and select the volume where we want to store this instance. then Click “Next: Add Tags” if we want any tags we can add here.

Step 5. Click “Next: Configure Security Group” here we will create a new security group with a name “Intrusion Group” and also add some description which is a good habit of doing because it will be easy to manage for large organizations.

EC2W-1

Figure 2. Adding new Security Group

Step 6. Click on “Review and Launch” and then select “Launch”, now we will create a new key pair and Don’t forget to download this pair because we cannot launch this instance without doing that.

Step 7. View Instances and wait till Instance status becomes Running and Status Checks become 2/2 Status Checks this will define the system check and instance check. After this is done our instance is ready to use.

CONNECTING TO OUR INSTANCE- WINDOWS USER

Step 1. Click on the instance that we created and select Connect which is located on the top, this will connect to the RDP port and asks us to Download Remote Desktop Protocol (RDP) File so and also will tell us to Get Password.

EC2W-4

Figure 3. RDP Connection

Step 2. After you download the RDP file open that and it will ask for the password, now we have to use the key pair which we downloaded before. Select Get Password and chose the file which we downloaded .pem format. Then select Decrypt Password which will convert the code into Clear Text which can be used as a password for our RDP file. That’s it, we are now connected to our Instance.

EC2W-5

Figure 4. Decrypting the key

EC2W-6

Figure 5. Entering The Key

If any issues occurred when connection to RDP file make sure of the following:

  1. You have downloaded the .pem file from the key pair and used the same one.
  2. In the Security group which we have created make sure RDP port 3389 is added to make the connection.
  3. Make sure the Password after decryption should be copied as it is, don’t remove any symbols or numbers in between.

CONCLUSION

We have learned how to create a Windows Server EC2 Instance and Connecting it using RDP file. Also, we learned how to make Connection using RDP on your computer.

 

INTRODUCTION TO AMAZON ELASTIC COMPUTE CLOUD (EC2)

In this module, we will learn how to create an instance and run in Windows environment. The instance we will be creating is Linux from Amazon Machine Image.

WHAT IS EC2?

These are the virtual machines which run on AWS cloud to help the developers to access and create them easily. EC2 instances have simple interface settings which can be configured easily and provides good security by running them on Amazon’s environment. There are many different machines which we can create instances but we need to pay for these machines.

CREATING EC2 INSTANCE

We will create Linux instance because Linux is the base of computing Operating System, in the next module we will install Windows Server instance.

Step 1. Go to Services and type “EC2” this will open the dashboard of EC2 where we can create our instance. Click “Launch Instance” 

Step 2. Select Linux Amazon Machine Image which is labeled as “Amazon Linux AMI 2017.03.1 (HVM), SSD Volume Type” and then Select. this will create the virtual machine installing Linux operating system in it.

 

EC2

Figure 1. Setting up EC2 Instance OS

 

Step 3. In this page we will have many virtual systems which are also named as Instance Type, we can see the properties of each Instance type by moving our mouse curse on that instance type. We will be using t2.micro instance because this is just the demonstration. In real time use, we can select other types but we need to pay them.

Step 4. In a single machine, we can launch as many instances are we can, this can be done by editing the setting in Configure Instance Details, we have Launch In Auto Scaling Group this will keep only healthy instances and remove the rest from the machine. The network will define our VPC network which we will create or we can set that to default network. Subnets will give us the available IP addresses in our region and we can also assign Public address which will be visible to the internet ( not recommended).

Step 5. At the bottom of the same page, we can add network interfaces as per our requirements if we have 3 Interfaces we can add them, some cases we need these.

Step 6.Click “Next: Add Storage” here we can add this instance to the volumes as per our choice. When we add a volume to this instance all the data will be stored in that volume, we can also save our snapshots in these volumes.

Step 7. Click “”Next: Add Tags” to add any tags just select Add Tags at the bottom, this will help us to locate this instance easily. Click “Next: Configure Security Groups”, here we will add the security groups which are created before or we can create a new group. Security groups will define the ports to allow this instance to maintain security always allow SSH port which is installed by default.

Step 8. Then select “Review and Launch” and Launch this instance, it will ask for a key pair because we need to make a secure connection with the instance we are creating. If we have a key pair select that from Existing key pairs or Create a new key pair and make sure we download that pair since that will be needed future to make a connection with this instance.

Step 9.  it will take some time to launch because it has to create a machine and install the Operating system inside it with all secure parameters. We can View this instance by clicking “View  Instances” and wait till the Instance status changes to Running and the status checks says 2/2 checks passed then our EC2 instance is ready to use. It will take some time please be patient.

 

EC2-1

Figure 2. Checking EC2 Instances

 

WINDOWS USERS ACCESS TO EC2 INSTANCE

After creating an instance we need to connect to that instance in a secure way. This can be done by using PuTTY Application which can be download from online (http://www.putty.org/). 

All the instances we have created will have two IP addresses- Private and public. To connect these two we need to insert keys in PuTTY application. The public IP address will then convert to Private by Network Address Translation (NAT) and the connection will take place. We also have internal DNS and external DNS, internal DNS can only be resolved within Amazon EC2. Public DNS will resolve public IP address outside Amazon EC2 and to private IP address in Amazon EC2 network.

Step 1. After we download PuTTY application Launch. In the hostname Copy the Public DNS from the EC2 Instance to resolve this to public IP address and make a secure connection. In hostname Column enter “ec2user@<COPY YOUR PUBLIC DNS HERE>”

 

EC2-4

figure 3. Using PuTTY Application

 

Step 2. To make a secure connection we need to do some settings in PuTTY application, In the left navigation bar of PuTTY console look for SSH and expand that, we can see Auth click on that. We can see many settings to configure but we will go Private Key file for Authentication and browse for the key.

 

EC2-6

Figure 4. Inserting Private Key

 

The key required or PuTTY application is .PPK file but when we download the key pair in EC2 instance we will download .PEM file, so now we need to convert .PEM format too .PPK format which can be done by PuTTYgen Application which we get when we download PuTTY. Click on Load to insert .PEM format and it will automatically convert to .PPK format and click Generate to Download that file.

 

EC2-7

Figure 5. Converting .pem to .ppk format

 

 

Step 3. Then Click “Open” in PuTTY application then its will connect to the Linux Machine which we have created as an instance if you didn’t get connected check the following steps and make sure you have done that:

  1. you entered “ec2user@” before copying your public DNS in Hostname column at PuTTY.
  2. You converted .PEM to .PPK format because .PPK format is only supported in PuTTY application.
  3. In the Security group, we created for this instance make sure you have Outbound Rules for TCP protocol Port 22 to make SSH connections.

 

EC2-8

Figure 6. Launching the Linux Instance

 

CONCLUSION

We have learned how to create EC2 Linux Instance and also how to connect that instance to the internet using PuTTY application. Basic Introduction of PuTTY application.