Amazon EC2 Operations: Difference between revisions
Jump to navigation
Jump to search
Line 12: | Line 12: | ||
aws [--region us-west-2] ec2 describe-instances [--instance-id ...] | aws [--region us-west-2] ec2 describe-instances [--instance-id ...] | ||
<syntaxhighlight lang='json'> | |||
{ | |||
"Reservations": [ | |||
{ | |||
"Instances": [ | |||
{ | |||
"Monitoring": { | |||
"State": "disabled" | |||
}, | |||
"PublicDnsName": "", | |||
"State": { | |||
"Code": 16, | |||
"Name": "running" | |||
}, | |||
"EbsOptimized": false, | |||
"LaunchTime": "2019-04-10T16:56:01.000Z", | |||
"PrivateIpAddress": "10.10.2.71", | |||
"ProductCodes": [], | |||
"VpcId": "vpc-1d3c8c4c1d99cd6ba", | |||
"CpuOptions": { | |||
"CoreCount": 1, | |||
"ThreadsPerCore": 1 | |||
}, | |||
"StateTransitionReason": "", | |||
"InstanceId": "i-01a053a09bf6d7b15", | |||
"EnaSupport": true, | |||
"ImageId": "ami-03338e1f67dae0168", | |||
"PrivateDnsName": "ip-10-10-2-71.ca-central-1.compute.internal", | |||
"KeyName": "outerworldly-key-pair", | |||
"SecurityGroups": [ | |||
{ | |||
"GroupName": "some-sg", | |||
"GroupId": "sg-04efb7c151570f2d0" | |||
} | |||
], | |||
"ClientToken": "", | |||
"SubnetId": "subnet-00102cd730cc69e0a", | |||
"InstanceType": "t2.micro", | |||
"NetworkInterfaces": [ | |||
{ | |||
"Status": "in-use", | |||
"MacAddress": "02:96:44:f3:af:08", | |||
"SourceDestCheck": true, | |||
"VpcId": "vpc-1d3c8c4c1d99cd6ba", | |||
"Description": "Primary network interface", | |||
"NetworkInterfaceId": "eni-07ebe1e63724f60f2", | |||
"PrivateIpAddresses": [ | |||
{ | |||
"Primary": true, | |||
"PrivateIpAddress": "10.10.2.71" | |||
} | |||
], | |||
"SubnetId": "subnet-00102cd730cc69e0a", | |||
"Attachment": { | |||
"Status": "attached", | |||
"DeviceIndex": 0, | |||
"DeleteOnTermination": true, | |||
"AttachmentId": "eni-attach-003a2cd69ddac31a4", | |||
"AttachTime": "2019-04-10T16:56:01.000Z" | |||
}, | |||
"Groups": [ | |||
{ | |||
"GroupName": "some-sg", | |||
"GroupId": "sg-04efb7c151570f2d0" | |||
} | |||
], | |||
"Ipv6Addresses": [], | |||
"OwnerId": "673499572719", | |||
"PrivateIpAddress": "10.10.2.71" | |||
} | |||
], | |||
"SourceDestCheck": true, | |||
"Placement": { | |||
"Tenancy": "default", | |||
"GroupName": "", | |||
"AvailabilityZone": "ca-central-1a" | |||
}, | |||
"Hypervisor": "xen", | |||
"BlockDeviceMappings": [ | |||
{ | |||
"DeviceName": "/dev/xvda", | |||
"Ebs": { | |||
"Status": "attached", | |||
"DeleteOnTermination": true, | |||
"VolumeId": "vol-0290718334f7ccdc0", | |||
"AttachTime": "2019-04-10T16:56:02.000Z" | |||
} | |||
} | |||
], | |||
"Architecture": "x86_64", | |||
"RootDeviceType": "ebs", | |||
"RootDeviceName": "/dev/xvda", | |||
"VirtualizationType": "hvm", | |||
"Tags": [ | |||
{ | |||
"Value": "01 instance", | |||
"Key": "Name" | |||
} | |||
], | |||
"AmiLaunchIndex": 0 | |||
} | |||
], | |||
"ReservationId": "r-0c51f172352815e10", | |||
"Groups": [], | |||
"OwnerId": "777777777777" | |||
} | |||
] | |||
<syntaxhighlight> | |||
=Configure a Public DNS Name to an EC2 Instance= | =Configure a Public DNS Name to an EC2 Instance= |
Revision as of 17:10, 10 April 2019
Internal
EC2 CLI
Instance Operations
Describe Instances
aws [--region us-west-2] ec2 describe-instances [--instance-id ...]
<syntaxhighlight lang='json'> {
"Reservations": [ { "Instances": [ { "Monitoring": { "State": "disabled" }, "PublicDnsName": "", "State": { "Code": 16, "Name": "running" }, "EbsOptimized": false, "LaunchTime": "2019-04-10T16:56:01.000Z", "PrivateIpAddress": "10.10.2.71", "ProductCodes": [], "VpcId": "vpc-1d3c8c4c1d99cd6ba", "CpuOptions": { "CoreCount": 1, "ThreadsPerCore": 1 }, "StateTransitionReason": "", "InstanceId": "i-01a053a09bf6d7b15", "EnaSupport": true, "ImageId": "ami-03338e1f67dae0168", "PrivateDnsName": "ip-10-10-2-71.ca-central-1.compute.internal", "KeyName": "outerworldly-key-pair", "SecurityGroups": [ { "GroupName": "some-sg", "GroupId": "sg-04efb7c151570f2d0" } ], "ClientToken": "", "SubnetId": "subnet-00102cd730cc69e0a", "InstanceType": "t2.micro", "NetworkInterfaces": [ { "Status": "in-use", "MacAddress": "02:96:44:f3:af:08", "SourceDestCheck": true, "VpcId": "vpc-1d3c8c4c1d99cd6ba", "Description": "Primary network interface", "NetworkInterfaceId": "eni-07ebe1e63724f60f2", "PrivateIpAddresses": [ { "Primary": true, "PrivateIpAddress": "10.10.2.71" } ], "SubnetId": "subnet-00102cd730cc69e0a", "Attachment": { "Status": "attached", "DeviceIndex": 0, "DeleteOnTermination": true, "AttachmentId": "eni-attach-003a2cd69ddac31a4", "AttachTime": "2019-04-10T16:56:01.000Z" }, "Groups": [ { "GroupName": "some-sg", "GroupId": "sg-04efb7c151570f2d0" } ], "Ipv6Addresses": [], "OwnerId": "673499572719", "PrivateIpAddress": "10.10.2.71" } ], "SourceDestCheck": true, "Placement": { "Tenancy": "default", "GroupName": "", "AvailabilityZone": "ca-central-1a" }, "Hypervisor": "xen", "BlockDeviceMappings": [ { "DeviceName": "/dev/xvda", "Ebs": { "Status": "attached", "DeleteOnTermination": true, "VolumeId": "vol-0290718334f7ccdc0", "AttachTime": "2019-04-10T16:56:02.000Z" } } ], "Architecture": "x86_64", "RootDeviceType": "ebs", "RootDeviceName": "/dev/xvda", "VirtualizationType": "hvm", "Tags": [ { "Value": "01 instance", "Key": "Name" } ], "AmiLaunchIndex": 0 } ], "ReservationId": "r-0c51f172352815e10", "Groups": [], "OwnerId": "777777777777" } ]
<syntaxhighlight>
Configure a Public DNS Name to an EC2 Instance
TODO
Load Balancing Operations
Key Pair Operations
It seems there is no way to create a Key pair as part of a CloudFormation template.
Create a Key Pair with Amazon Console
AWS -> EC2 -> Key Pairs -> Create Key Pair.