How to Install New Ec2 Instance through awscli in aws

Channel:
Subscribers:
2,060
Published on ● Video Link: https://www.youtube.com/watch?v=6jkZBLCFtHQ



Duration: 22:54
14 views
1


copy command for your reference

create VPC - aws ec2 create-vpc --cidr-block 10.0.0.0/16

create subnet - aws ec2 create-subnet --vpc-id vpcId --cidr-block 10.0.1.0/24

second subnet - aws ec2 create-subnet --vpc-id vpcId --cidr-block 10.0.0.0/24

create internet gateway - aws ec2 create-internet-gateway

After the internet gateway is created, note the InternetGatewayId and to attach this internet gateway to the already created VPC. To do so use the below command:

attached gateway - aws ec2 attach-internet-gateway --vpc-id vpcId --internet-gateway-id InternetGatewayId

creating routing table - aws ec2 create-route-table --vpc-id vpcId

Now, use the RouteTableId and use it in the next step:

create route - aws ec2 create-route --route-table-id RouteTableId --destination-cidr-block 0.0.0.0/0 --gateway-id nternetGatewayI

view the route table and subnet -
1.1 aws ec2 describe-route-tables --route-table-id RouteTableId

1.2 aws ec2 describe-subnets --filters "Name=vpc-id,Values=vpc-0cd2ff72d74bec455" --query "Subnets[*].{ID:SubnetId,CIDR:CidrBlock}"

associating route table - aws ec2 associate-route-table --subnet-id SubnetId --route-table-id RouteTableId

To map the public IP to the subnet, use the below command:

map - aws ec2 modify-subnet-attribute --subnet-id SubnetId --map-public-ip-on-launch

Creating Key Pair and Security Group

aws ec2 create-key-pair --key-name awscli --query "KeyMaterial" --output text "D:\awscli.pem"

For security group use the below commands:

aws ec2 create-security-group --group-name security-group-name --description "description" --vpc-id vpcId

GroupId and use it in the next step.

aws ec2 authorize-security-group-ingress --group-id GroupId --protocol tcp --port 22 --cidr 0.0.0.0/0

aws ec2 authorize-security-group-ingress --group-id sg-0b03bf29683a98bff --protocol tcp --port 80 --cidr 0.0.0.0/0

Running the EC2 Instance
aws ec2 run-instances --image-id ami-id --count 1 --instance-type t2.micro --key-name Keypair-name --security-group-ids SecurityGroupId --subnet-id SubnetId

view your instance

aws ec2 describe-instances --instance-id InstanceId




Other Videos By AI-Tondak


2022-07-21Amarnath ki Pavitra gufa 21-07-2022
2022-07-20Amarnath Yatra 2022 | After Cloud Buster | Pahalgam Se |Amarnath Trip Vlog Part-1
2022-07-13IT How to Fixed Assets Entry in SAP B1
2022-07-11IT How To Filed TCS Return with WEBTEL Software and Upload Income Tax Portal
2022-07-09IT - How to filled GSTR 1 Return With Offline Utility
2022-06-28Go Pro 10 Camera Office Review in Hindi
2022-06-23IT - How to Search Pan Number Through Tan Number
2022-06-05!T - How To Create Clone for testing in SAP B1
2022-05-29!T - How to Change User name and Password in SAP B1
2021-10-15How to Configure ssh in kali linux without pem file AWS instance
2021-09-09How to Install New Ec2 Instance through awscli in aws
2021-09-08How to Configure awscli in ec2-instance by iTondak
2021-09-05How to Install centos 7 in aws instance and configuration for ssh
2021-09-05How to Download google photo all in laptop mute version
2021-09-04How to Gmail Setup in Outlook Configuration (enter your user name Popup)
2021-06-20Python Level - 8 How to use def() function in python ! in Python by iTondak!
2021-05-29Python Level - 7 How to make a Hangman game Program with use all function in Python by iTondak!
2021-05-22Python Level - 6 How to use Function and Play With Reeborg World in Python by iTondak!
2021-05-15Python Level - 5 How to use For Loop and make a password generator in Python by iTondak!
2021-05-08Python Exercise-4 How To Program Find Enemy ,Partner Mood and Rock Paper and Scissor game by iTondak
2021-05-05Python Level - 4.2 how to use data structure in Python by iTondak!