官术网_书友最值得收藏!

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
主站蜘蛛池模板: 松滋市| 绩溪县| 柳河县| 河北区| 申扎县| 仙居县| 鸡东县| 天柱县| 达州市| 林周县| 岳池县| 和政县| 镇平县| 元江| 夏河县| 清远市| 成都市| 西丰县| 济阳县| 富裕县| 炉霍县| 曲周县| 奎屯市| 绥滨县| 巴青县| 张家界市| 扎兰屯市| 淄博市| 大田县| 寿宁县| 嘉兴市| 石泉县| 蒙城县| 岱山县| 蚌埠市| 邹平县| 东兰县| 佛坪县| 龙海市| 云梦县| 岳普湖县|