AWS Cloud using AWS CLI.

AWS Cloud using AWS CLI.

AWS CSA Training Task : 2

1.Create a key pair

2.Create a security group

3.Launch an Instance using the above created key pair and security group

4.Create an EBS volume and attach it to instance.

All the above steps must be performed using AWS CLI.

1.Create a key pair Before starting we should have AWS account and AWS CLI install on our machine. After creating we should create one user and we should know Credentials i.e. Access key and secret key.we can check AWS CLI is present or not using aws --version. After that we should authenticate account like

No alt text provided for this image

After that to create key pair write aws ec2 create-key-pair --key-name key_name

No alt text provided for this image

here you can see key is created

No alt text provided for this image

2.Create a security group Lets start with second step here we know A security group acts as a virtual firewall for your instance to control inbound and outbound traffic. You have a default security group for use in EC2-Classic and a default security group for use in your VPC. If you don't specify a security group when you launch an instance, the instance is launched into the appropriate default security group. A default security group includes a default rule that grants instances unrestricted network access to each other. Lets create security group

No alt text provided for this image

here an inbound rule permits instances to receive traffic from the specified IPv4 or IPv6 CIDR address ranges, or from the instances associated with the specified destination security groups.we should add inbound rule for this security using following command

No alt text provided for this image

here you can see

No alt text provided for this image

3.Launch an Instance using the above created key pair and security group Here to launch instance we should know AMI_id,key_name and instance type . these three things are mandatory. If you don't specify a subnet ID, we choose a default subnet from your default VPC for you. If you don't have a default VPC, you must specify a subnet ID in the request. If don't specify an Availability Zone, we choose one for you. Some instance types must be launched into a VPC. If you do not have a default VPC, or if you do not specify a subnet ID, the request fails. For more information, see Instance types available only in a VPC . All instances have a network interface with a primary private IPv4 address. If you don't specify this address, we choose one from the IPv4 range of your subnet. If you don't specify a security group ID, we use the default security group. For more information, see Security groups . lets launch instance

No alt text provided for this image

here you can see

No alt text provided for this image

4.Create an EBS volume and attach it to instance. Here we are gonna create EBS volume and we will attach that volume to above running instance. Creates an EBS volume that can be attached to an instance in the same Availability Zone. The volume is created in the regional endpoint that you send the HTTP request to.lets create EBS volume

No alt text provided for this image

you can see here

No alt text provided for this image

lets attach this volume to instance

No alt text provided for this image

here you can see this volume is in use means it attached to instance

No alt text provided for this image

Here to detach volume and terminate instance use following commands

No alt text provided for this image
No alt text provided for this image

Thank you for reading this article.

Onkar Naik

DevOps @Forescout ?? | Google Developer Expert | AWS | DevOps | 3X GCP | 1X Azure | 1X Terraform | Ansible | Kubernetes | SRE | Platform | Jenkins | Tech Blogger ??

4 年

Great work GANESH CHAUDHARI

回复
Onkar Kadam

Software Engineer at NICE | Ex-Digitate | Java | Spring Boot | Microservices | DM for Referral

4 年

Nice one!!

回复
Sagar Gavhane

Associate || Senior Software Engineer @ Capgemini || ASP.NET || C# || Python

4 年

Great ??

回复

要查看或添加评论,请登录

Ganesh Chaudhari的更多文章

社区洞察

其他会员也浏览了