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
After that to create key pair write aws ec2 create-key-pair --key-name key_name
here you can see key is created
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
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
here you can see
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
here you can see
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
you can see here
lets attach this volume to instance
here you can see this volume is in use means it attached to instance
Here to detach volume and terminate instance use following commands
Thank you for reading this article.
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
Software Engineer at NICE | Ex-Digitate | Java | Spring Boot | Microservices | DM for Referral
4 年Nice one!!
Associate || Senior Software Engineer @ Capgemini || ASP.NET || C# || Python
4 年Great ??