Nuove Direttive UE sugli IMP

Insieme al nuovo Regolamento EU GCP 536/2014, il 16 settembre 2017 la Commissione UE ha pubblicato una nuova lineaguida GMP sugli investigational medicinal products (IMPs) ad uso umano. La…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Create a VPC with an Autoscaling Group

For the project this week we have a few steps to do!

Create a VPC with cidr 10.10.0.0/16 with an autoscaling group using t2.micro instances. All instances should have apache installed on each instance with the ability to check any random IP address and be able to produce a test page.

The instance min and max should be 2 and 5 and should have a scaling policy with cloudwatch to scale after cpu utilization is above 80%

After the autoscaling group has been created, find a stress tool to be able to stress an instance above 80% to see if your scaling policy works!

Let’s get started!

1| First things first, we are going to create our VPC. We do this by searching for VPC in the console and click on Create VPC in the top right corner. For this project we are going to use the VPC wizard that sets up most everything for us. We do that by clicking on the VPC, Settings, etc under VPC Settings. The only things we need to tweak are the name-tag and the cidr. You can name it what you would like and for the cidr we need to change it to 10.10.0.0/16 as requested. Scroll down and click Create VPC.

2| Our next step is to go and create a launch template for our ec2 instance. Search ec2 and on the left side find “launch templates”. Go ahead and name your launch template and give it a description of your choice so you remember what is going on. Beneath that check off the box that says “Provide guidance to help me set up a template that I can use with EC2 Auto Scaling”. After that under the Application and OS Images (Amazon Machine Image) — required we will change Amazon Machine Image (ami) to Amazon Linux 2 with the instance type being t2.micro.

Keep scrolling down and we will need to either create or choose a key pair that is available to use. After that we will create a specific security group and include some rules that will allow us to access the web page. These rules will also allow us to ssh into the instance and test some things later on. Name your security group, give it a description, and attach the VPC that we created earlier. We will give it two security group rules — the first one being ssh. For both rules we want the source type to be from anywhere. This will leave you wide open and vulnerable so make sure to change your settings when you do this on a real project. Under Advanced Network Configuration we will add a network interface and enable Auto-Assign public IP.

One of our last steps is to go under Advanced details and enable Detailed CloudWatch monitoring. Keep scrolling down we find the User data. This is where we will attach our bootstrap script. And this is what we will enter:

Click on Create launch template. Your launch template has been successfully created!

3| Our next step is to create an auto-scaling group from the launch template we just created.

Name your launch template and scroll down and click next.

For our network we are going to change the VPC to the one we created and with the availability zones and subnets we are going to choose the two public options to give us more availability.

Click on next at the bottom. On the next page the only setting we are going to change is the Additional Settings. We are going to check off the box that says Enable group metrics collection within CloudWatch.

On the Configure group size and scaling policies page we are going to change a few settings. Under group size we change the Desired Capacity to 2, the Minimum Capacity to 2, and the Maximum Capacity to 5.

Under Scaling policies we want to click on the box that says Target tracking scaling policy. You can name it what you would like. The metric type we need is Average CPU utilization with the Target value at 80 and Instances need at 30 seconds. At the bottom, click Next!

We will not be adding notifications or tags to this project so keep clicking next. At the bottom of the review page, click on Create Auto Scaling Group.

4| Search ec2 in the search bar at the top to go back and see your instances. You will see two instances that are starting up. We can check to make sure they are functioning properly by getting the public IPv4 address from them and typing it in the browser search bar. You will notice that just putting in the IPv4 address by itself won’t work. You will need to put in a http://<IPv4 address> to access the website. If you were successful, you will see this page.

5| Now we need to do our stress test. We are going to ssh into our instance with this command:

After we are in our instance, we will use this command to start the stress test.

As you can see, our instances were stressed out when we look at the monitoring tab in one of our instances.

*I will say that I was not able to get the instance stressed out enough to get it to scale up and generate a new instance. I did go back and create a new Target level of 40% and re-tested it. After running the stress test, I was able to have it scale out and get more instances.

Thanks for following along!

Add a comment

Related posts:

The Importance of Being Vulnerable at Work with Diane Lloyd

In this episode of Relationships at Work, Russel chats with executive leadership coach, CEO and Dare to Lead facilitator Diane Lloyd on the importance of vulnerability and in bringing your full self…

Being appalled and trans

It sounds like our exchange is coming to a close. I’m fine with that. I just want to respond to a few points you make: Some black people agree that sometimes the best way for non-black racist people…