- Effective DevOps with AWS
- Yogesh Raheja Giuseppe Borgese Nathaniel Felsen
- 310字
- 2021-07-23 16:27:29
Launching an EC2 instance
We now have all the information required to launch our instance. Let's finally launch it as follows:
$ aws ec2 run-instances \
--instance-type t2.micro \
--key-name EffectiveDevOpsAWS \
--security-group-ids sg-01864b4c \
--image-id ami-cfe4b2b0
{
"Instances": [
{
"Monitoring": {
"State": "disabled"
},
"PublicDnsName": "",
"StateReason": {
"Message": "pending",
"Code": "pending"
},
"State": {
"Code": 0,
"Name": "pending"
},
"EbsOptimized": false,
"LaunchTime": "2018-08-08T06:38:43.000Z",
"PrivateIpAddress": "172.31.22.52",
"ProductCodes": [],
"VpcId": "vpc-4cddce2a",
"CpuOptions": {
"CoreCount": 1,
"ThreadsPerCore": 1
},
"StateTransitionReason": "",
"InstanceId": "i-057e8deb1a4c3f35d",
"ImageId": "ami-cfe4b2b0",
"PrivateDnsName": "ip-172-31-22-52.ec2.internal",
"KeyName": "EffectiveDevOpsAWS",
"SecurityGroups": [
{
"GroupName": "HelloWorld",
"GroupId": "sg-01864b4c"
}
],
"ClientToken": "",
"SubnetId": "subnet-6fdd7927",
"InstanceType": "t2.micro",
"NetworkInterfaces": [
{
"Status": "in-use",
"MacAddress": "0a:d0:b9:db:7b:38",
"SourceDestCheck": true,
"VpcId": "vpc-4cddce2a",
"Description": "",
"NetworkInterfaceId": "eni-001aaa6b5c7f92b9f",
"PrivateIpAddresses": [
{
"PrivateDnsName": "ip-172-31-22-
52.ec2.internal",
"Primary": true,
"PrivateIpAddress": "172.31.22.52"
}
],
"PrivateDnsName": "ip-172-31-22-52.ec2.internal",
"Attachment": {
"Status": "attaching",
"DeviceIndex": 0,
"DeleteOnTermination": true,
"AttachmentId": "eni-attach-0428b549373b9f864",
"AttachTime": "2018-08-08T06:38:43.000Z"
},
"Groups": [
{
"GroupName": "HelloWorld",
"GroupId": "sg-01864b4c"
}
],
"Ipv6Addresses": [],
"OwnerId": "094507990803",
"SubnetId": "subnet-6fdd7927",
"PrivateIpAddress": "172.31.22.52"
}
],
"SourceDestCheck": true,
"Placement": {
"Tenancy": "default",
"GroupName": "",
"AvailabilityZone": "us-east-1c"
},
"Hypervisor": "xen",
"BlockDeviceMappings": [],
"Architecture": "x86_64",
"RootDeviceType": "ebs",
"RootDeviceName": "/dev/xvda",
"VirtualizationType": "hvm",
"AmiLaunchIndex": 0
}
],
"ReservationId": "r-09a637b7a3be11d8b",
"Groups": [],
"OwnerId": "094507990803"
}
You can track the progress of the instance creation. To do that, get the instance ID provided in the output of the aws ec2 run-instances command and run the following command:
$ aws ec2 describe-instance-status --instance-ids i-057e8deb1a4c3f35d
{
"InstanceStatuses": [
{
"InstanceId": "i-057e8deb1a4c3f35d",
"InstanceState": {
"Code": 16,
"Name": "running"
},
"AvailabilityZone": "us-east-1c",
"SystemStatus": {
"Status": "initializing",
"Details": [
{
"Status": "initializing",
"Name": "reachability"
}
]
},
"InstanceStatus": {
"Status": "initializing",
"Details": [
{
"Status": "initializing",
"Name": "reachability"
}
]
}
}
]
}
The instance will be ready once the status under SystemStatus changes from initializing to ok:
$ aws ec2 describe-instance-status --instance-ids i-057e8deb1a4c3f35d --output text| grep -i SystemStatus
SYSTEMSTATUS ok
推薦閱讀
- Mastering Proxmox(Third Edition)
- 網上沖浪
- 輕松學Java Web開發
- 網頁編程技術
- Hands-On Cloud Solutions with Azure
- 機器人智能運動規劃技術
- 大數據技術與應用
- Ceph:Designing and Implementing Scalable Storage Systems
- Machine Learning with Apache Spark Quick Start Guide
- PVCBOT機器人控制技術入門
- 三菱FX/Q系列PLC工程實例詳解
- 洞察大數據價值:SAS編程與數據挖掘
- R:Predictive Analysis
- AI成“神”之日:人工智能的終極演變
- 新手學Illustrator CS6平面廣告設計