1595508360
There are a variety of situations where having a microservice available that can manage (Create, start, stop or terminate)EC2 instances at will can be handy. In this article, we are going to see how we can use an AWS Lambda to do such a thing on demand without using any extra servers or instances at all.
we will write a Lambda function that will create an EC2 instance. This Lambda function will be written in Python using the Boto3 library. We will also create a custom Lambda execution policy for our IAM role. When we’re done, we will be able to log in to the new EC2 instance via SSH.
Let’s navigate to AWS Identity and Access Management (IAM) to create a role for our AWS Lambda function.
Select Role > Create Role > Select AWS service
> Select Lambda
As a use case and create a role with the below policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"ec2:*"
],
"Resource": "*"
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": "logs:CreateLogGroup",
"Resource": "arn:aws:logs:*:*:*"
}
]
}
Functions > Create Function
**Choose or create an execution role**
> SelectUse an existing role
.#aws #automation-testing #aws-lambda #devops #aws-ec2
1621745280
Secure and resizable compute capacity in the cloud.
Amazon Elastic Compute Cloud ( Amazon EC2) is a web service that provides secure, resizable compute capacity in the cloud. It is designed to make web-scale cloud computing easier for developers.
In this article let us see how to create On-demand EC2 instance from Console.
#create-ec2-instance #aws-ec2-instance #ec2-instance #amazon-web-services #aws
1595508360
There are a variety of situations where having a microservice available that can manage (Create, start, stop or terminate)EC2 instances at will can be handy. In this article, we are going to see how we can use an AWS Lambda to do such a thing on demand without using any extra servers or instances at all.
we will write a Lambda function that will create an EC2 instance. This Lambda function will be written in Python using the Boto3 library. We will also create a custom Lambda execution policy for our IAM role. When we’re done, we will be able to log in to the new EC2 instance via SSH.
Let’s navigate to AWS Identity and Access Management (IAM) to create a role for our AWS Lambda function.
Select Role > Create Role > Select AWS service
> Select Lambda
As a use case and create a role with the below policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"ec2:*"
],
"Resource": "*"
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": "logs:CreateLogGroup",
"Resource": "arn:aws:logs:*:*:*"
}
]
}
Functions > Create Function
**Choose or create an execution role**
> SelectUse an existing role
.#aws #automation-testing #aws-lambda #devops #aws-ec2
1627169220
In this video we are going to learn the differences between ec2 vs lambda by going over:
#aws #lambda #ec2 #serverless #aws lambda
1597954680
For those new to EC2, EC2 offers auto-scalable instances with compute, memory, storage and networking, deployable in multiple Availability zones/Regions while targetable by a load balancer along with management / administration tools such as AWS Systems Manager and AWS License Manager. EC2 instances are available under multiple purchase options such as Spot, On-Demand, Reserved and Savings Plan. It offers a broad choice of processors such as Intel, AMD and Amazon’s very own ARM-based Graviton processors. EC2 also allows the possibility of using Application Specific Integrated-Circuit (ASICs) and Field Programmable Gate-Array (FPGAs).
For those new to terms like ASIC and FPGA, they provide an alternate way to compute than CPU and GPU. Unlike CPU and GPU, which have a predefined instruction set and general purpose or parallel computing optimized , ASICs are dedicated, custom designed and optimized for one specific function (for e.g. bitcoin mining) whereas FPGAs are, as their name suggests, programmable digital logic cells. The hardware can be reprogrammed / repurposed to different workloads. Neither ASICs nor FPGAs have a predefined instruction set.
Amazon launched EC2 with one instance type, m1, in the year 2006. This machine offered 1.7 GHz of CPU, 1.75 GB of RAM, 160 GB of disk and 250 Mbps of network bandwidth. This has evolved to 300+ instance types as of July 2020.
EC2 currently offers instance with upto 4.0GHz of CPU(z1d), 24576 GB / 24 TB of RAM(u-24tb1.metal), 48 TB of disk (d2.8xlarge) and 100 Gbps of Network bandwidth (High-Memory instances). Nitro turbo-charged this evolution in 2017 at which time “only” 42 instance types were available. It allowed new CPU architectures (ARM, AMD), bare metal offerings, 100 Gbps networking, EFA etc. So what exactly is Nitro?
Nitro refers to a whole fleet of changes, hardware and software, brought about in order to improve two important aspects of the infrastructure: performance and security. The basic idea is about offloading functions that are generally performed in a hypervisor stack to separate dedicated hardware / software component. Before Nitro — Networking, Storage, Security etc. were part of the hypervisor stack and contributed to about 30% of resource consumption that could not be used by customer instances.
With Nitro architecture, these components are moved out of the hypervisor stack, allowing for better resource consumption / performance and more controlled security.
#aws #ec2 #ec2-instance #nitro #aws-ec2
1595500920
We created an AWS Lambda function that creates an EC2 instance in my previous article. Today we will gonna talk about How can we manage EC2 Instance with AWS Lambda.
we will write a Lambda function that will manage an EC2 instance. This Lambda function will be written in Python using the Boto3 library as well as Javascript. We will also create a custom Lambda execution policy for our IAM role. When we’re done, we will be able to manage EC2 instances via the AWS Lambda function.
Let’s navigate to AWS Identity and Access Management (IAM) to create a role for our AWS Lambda function.
Select Role > Create Role > Select AWS service
> Select Lambda
As a use case and create a role with the below policy.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"ec2:*"
],
"Resource": "*"
},
{
"Sid": "VisualEditor2",
"Effect": "Allow",
"Action": "logs:CreateLogGroup",
"Resource": "arn:aws:logs:*:*:*"
}
]
}
Python 3.7
or Node.js
.4. Choose to Create a function.
5. Copy this code, and then under Function code, paste it into the editor panel in the code editor (lambda_function).
This code Starts the EC2 instances that you identify.
#devops #aws-lambda #aws #ec2