-
Notifications
You must be signed in to change notification settings - Fork 3
21._EC2
$ awsm listCommandInvocations --help
NAME:
awsm listCommandInvocations - List SSM Command Invocations
USAGE:
awsm listCommandInvocations [command options] [arguments...]
ARGUMENTS:
[search] - The keyword to search for
OPTIONS:
--details details (Shows the output of each command)
awsm listCommandInvocations
This will list all SSM Command Invocations, the output should look similar to this:
$ awsm listCommandInvocations
+--------------------------------------+---------+----------------+---------------------+---------------------+--------------------+----------------+--------------+-----------+
| COMMAND ID | STATUS | STATUS DETAILS | INSTANCE NAME | INSTANCE ID | DOCUMENT NAME | REQUESTED | SERVICE ROLE | REGION |
+--------------------------------------+---------+----------------+---------------------+---------------------+--------------------+----------------+--------------+-----------+
| e55c7f09-8eaf-493b-9aa1-feb190278060 | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 29 minutes ago | | us-west-2 |
| 9515cb1f-f12a-454a-8eef-201d90ab7839 | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 32 minutes ago | | us-west-2 |
| 46f8b349-d145-4c13-8a88-fe41d7e5850a | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 33 minutes ago | | us-west-2 |
| a2de836a-3f26-4a5e-93af-7e64ddda714d | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 34 minutes ago | | us-west-2 |
| 11f7ef2d-e239-446b-ab6e-4ffdab6baaef | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 37 minutes ago | | us-west-2 |
| 88f40e87-d73f-4b7d-85c4-53568a05b1e5 | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 45 minutes ago | | us-west-2 |
| 2b8b6124-0620-4b15-8162-3029d50f6ccb | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 1 hour ago | | us-west-2 |
| 6ca20857-6413-492d-961a-3eaa96d7d73a | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 1 hour ago | | us-west-2 |
| 6420bae7-17c8-4cd6-8997-9b4a51847f4c | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 1 week ago | | us-west-2 |
| 17642e2d-51e1-427a-9a9d-6b66c2608dac | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 1 week ago | | us-west-2 |
| 6a2eabf3-c976-419d-ac26-794ebcea408f | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 1 week ago | | us-west-2 |
| 6edd27d1-68e8-4abe-bed6-b402b00936a8 | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 1 week ago | | us-west-2 |
| 566e81c3-811e-4e3d-9fab-d83461cb7c81 | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 2 weeks ago | | us-west-2 |
| 96957774-dd59-48e0-8bf6-247d71a28f75 | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 2 weeks ago | | us-west-2 |
| 27b8036b-ea48-440a-ac83-6b38a836ec54 | Success | Success | i-0108c10a8e126bf41 | i-0108c10a8e126bf41 | AWS-RunShellScript | 3 weeks ago | | us-west-2 |
| 13246bd9-2714-4ba8-9e7b-c93dd1913fb8 | Success | Success | i-0108c10a8e126bf41 | i-0108c10a8e126bf41 | AWS-RunShellScript | 3 weeks ago | | us-west-2 |
| c61edd58-7585-41ff-a475-cd865ec346c0 | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 3 weeks ago | | us-west-2 |
| 4b667b3f-d1e0-4f9d-9ea8-62ad70cd4806 | Success | Success | dev11 | i-0fc6a657c8f693220 | AWS-RunShellScript | 3 weeks ago | | us-west-2 |
| bc2fbbca-21e7-4ec4-86cb-2af5984d19cf | Success | Success | dev2-new | i-0dd843fbadcf7fd63 | AWS-RunShellScript | 44 minutes ago | | us-east-1 |
| 1b38a3a7-03dd-461f-b4a9-9ee605f215eb | Success | Success | dev2-new | i-0dd843fbadcf7fd63 | AWS-RunShellScript | 45 minutes ago | | us-east-1 |
| e9fad068-adc4-4699-9074-27d03e6c39a4 | Success | Success | dev2-new | i-0dd843fbadcf7fd63 | AWS-RunShellScript | 4 hours ago | | us-east-1 |
| 99633572-6169-4fa3-8dd4-241c79b39d97 | Success | Success | dev2-new | i-0dd843fbadcf7fd63 | AWS-RunShellScript | 4 hours ago | | us-east-1 |
+--------------------------------------+---------+----------------+---------------------+---------------------+--------------------+----------------+--------------+-----------+
$ awsm listInstances --help
NAME:
awsm listInstances - List EC2 Instances
USAGE:
awsm listInstances [arguments...]
ARGUMENTS:
[search] - The keyword to search for
awsm listInstances dev
This will list all Instances matching the term dev
, the output should look similar to this:
$ awsm listInstances dev
+----------+-------+------------+-----------+---------------------+--------------+------+----------+---------+------------+-------------------+---------------+---------+----------------------+
| NAME | CLASS | PRIVATE IP | PUBLIC IP | INSTANCE ID | AMI | ROOT | SIZE | STATE | KEYPAIR | AVAILABILITY ZONE | VPC | SUBNET | IAM INSTANCE PROFILE |
+----------+-------+------------+-----------+---------------------+--------------+------+----------+---------+------------+-------------------+---------------+---------+----------------------+
| dev2 | dev | 10.1.2.82 | | i-064f2aefd1dfd2934 | hvm-base | ebs | r3.large | running | salonEast | us-east-1a | us-east-1-vpc | Private | |
| dev2-new | dev | 10.1.2.4 | | i-0dd843fbadcf7fd63 | awsm-init-v3 | ebs | r3.large | running | awsm | us-east-1a | us-east-1-vpc | Private | awsm |
| dev1 | dev | 10.0.2.47 | | i-04643fa708a34815d | hvm-base | ebs | r3.large | running | salonWest2 | us-west-2a | us-west-2-vpc | Private | |
| dev11 | dev | 10.0.2.64 | | i-0fc6a657c8f693220 | awsm-init-v3 | ebs | r3.large | running | awsm | us-west-2a | us-west-2-vpc | Private | awsm |
+----------+-------+------------+-----------+---------------------+--------------+------+----------+---------+------------+-------------------+---------------+---------+----------------------+
$ awsm listSSMInstances --help
NAME:
awsm listSSMInstances - List SSM Instances
USAGE:
awsm listSSMInstances [arguments...]
ARGUMENTS:
[search] - The keyword to search for
awsm listSSMInstances
This will all SSM Instances, the output should look similar to this:
$ awsm listSSMInstances
+----------+-------+---------------+---------------------+------------+---------------+-------------+---------------+---------------+------------------+---------------+----------------+---------------+-----------+
| NAME | CLASS | COMPUTER NAME | INSTANCE ID | IP ADDRESS | LAST PING | PING STATUS | PLATFORM NAME | PLATFORM TYPE | PLATFORM VERSION | AGENT VERSION | LATEST VERSION | RESOURCE TYPE | REGION |
+----------+-------+---------------+---------------------+------------+---------------+-------------+---------------+---------------+------------------+---------------+----------------+---------------+-----------+
| dev11 | dev | dev11 | i-0fc6a657c8f693220 | 10.0.2.64 | 1 minute ago | Online | Ubuntu | Linux | 16.04 | 2.0.767.0 | false | EC2Instance | us-west-2 |
| dev2-new | dev | dev2 | i-0dd843fbadcf7fd63 | 10.1.2.4 | 2 minutes ago | Online | Ubuntu | Linux | 16.04 | 2.0.822.0 | true | EC2Instance | us-east-1 |
+----------+-------+---------------+---------------------+------------+---------------+-------------+---------------+---------------+------------------+---------------+----------------+---------------+-----------+
$ awsm launchInstance --help
NAME:
awsm launchInstance - Launch an EC2 instance
USAGE:
awsm launchInstance [arguments...]
ARGUMENTS:
class - The class of the instance (dev, stage, etc)
sequence - The sequence of the instance (1...100)
az - The availability zone to launch the instance in (us-west-2a, us-east-1a, etc)
awsm launchInstance dev 9 us-west-2a
This will launch an EC2 instance named dev9
into the us-west-2a
based on the dev
Class configuration, the output should look similar to this:
$ awsm launchInstance dev 9 us-west-2a
✓ Found Instance class configuration for [dev]!
✓ Found Availability Zone [us-west-2a]!
✓ Found AMI [ami-8dcb5fed] with class [awsm-init] created [2 months ago]!
✓ Found Volume Class Configuration for [code]!
✓ Found Snapshot [snap-0fb65c42b976bc66d] with class [code] created [2 months ago]!
✓ Found Volume Class Configuration for [mysql-data]!
✓ Found Snapshot [snap-0b8dfe5cf568bf6af] with class [mysql-data] created [3 hours ago]!
✓ Found IAM Instance Profile [awsm]!
✓ Found KeyPair [awsm] in [us-west-2]!
✓ Found VPC [vpc-551c1637] in Region [us-west-2]!
✓ Found Subnet [subnet-c36a5fb7] in VPC [vpc-551c1637]!
✓ Found VPC Security Group [sg-c57167a7] with name [dev]!
△ Launching Instance:
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| NAME | CLASS | PRIVATE IP | PUBLIC IP | INSTANCE ID | AMI | ROOT | SIZE | STATE | KEYPAIR | AVAILABILITY ZONE | VPC | SUBNET | IAM INSTANCE PROFILE |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| dev9 | dev | 10.0.2.117 | | i-05e75f2c3d81b9890 | ami-8dcb5fed | ebs | r3.large | pending | awsm | us-west-2a | us-west-2-vpc | Private | awsm |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
▶ Waiting to tag Instance...
△ Adding EC2 Tags...
▶ Waiting to tag EBS Volumes...
△ Adding EBS Tags...
✓ Finished Launching Instance!
$ awsm runCommand --help
NAME:
awsm runCommand - Run a command on a set of EC2 Instances
USAGE:
awsm runCommand [arguments...]
ARGUMENTS:
search - The search term for the instances to run the command on
command - The command to run on the instances
awsm runCommand dev11 "uptime"
This will run the command uptime
on the SSM Instance matching the term dev11
and return the results, the output should look similar to this:
$ awsm runCommand dev11 "uptime"
+-------+-------+---------------+---------------------+------------+---------------+-------------+---------------+---------------+------------------+---------------+----------------+---------------+-----------+
| NAME | CLASS | COMPUTER NAME | INSTANCE ID | IP ADDRESS | LAST PING | PING STATUS | PLATFORM NAME | PLATFORM TYPE | PLATFORM VERSION | AGENT VERSION | LATEST VERSION | RESOURCE TYPE | REGION |
+-------+-------+---------------+---------------------+------------+---------------+-------------+---------------+---------------+------------------+---------------+----------------+---------------+-----------+
| dev11 | dev | dev11 | i-0fc6a657c8f693220 | 10.0.2.64 | 5 seconds ago | Online | Ubuntu | Linux | 16.04 | 2.0.767.0 | false | EC2Instance | us-west-2 |
+-------+-------+---------------+---------------------+------------+---------------+-------------+---------------+---------------+------------------+---------------+----------------+---------------+-----------+
▶ Are you sure you want to run the command [uptime] on these instances?
◀ y
△ Sending Command [uptime] to instances [dev11] in [us-west-2]!
✓ Sent Command [uptime] [ada72c6f-b0bc-4a38-8a3d-bb0456250f0e] to instances [dev11] in [us-west-2]!
▶ Waiting for response from [us-west-2]..
✓ Recieved a response from [us-west-2]!
✓ Done!
✓ Found [1] SSM Command Invocations!
===========================================================================
Instance: dev11, i-0fc6a657c8f693220
Region: us-west-2
Status: Success
Requested: 11 seconds ago
Command ID: ada72c6f-b0bc-4a38-8a3d-bb0456250f0e
Comment: awsm sendCommand: uptime
Command #1 [aws:runShellScript] Output:
23:27:17 up 9 days, 18:34, 1 user, load average: 0.00, 0.00, 0.85
===========================================================================
$ awsm stopInstances --help
NAME:
awsm stopInstances - Stop instances
USAGE:
awsm stopInstances [command options] [arguments...]
ARGUMENTS:
search - The search term for instance to stop
[region] - The region of the instance (optional)
OPTIONS:
--force force (Force deletes all instances and lifecycle actions)
awsm stopInstances dev9
This will stop EC2 Instances matching the term dev9
, the output should look similar to this:
$ awsm stopInstances dev9
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| NAME | CLASS | PRIVATE IP | PUBLIC IP | INSTANCE ID | AMI | ROOT | SIZE | STATE | KEYPAIR | AVAILABILITY ZONE | VPC | SUBNET | IAM INSTANCE PROFILE |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| dev9 | dev | 10.0.2.117 | | i-05e75f2c3d81b9890 | awsm-init-v3 | ebs | r3.large | running | awsm | us-west-2a | us-west-2-vpc | Private | awsm |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
▶ Are you sure you want to stop these Instances?
◀ y
△ Stopped Instance [i-05e75f2c3d81b9890] named [dev9] in [us-west-2a]!
✓ Done!
$ awsm startInstances --help
NAME:
awsm startInstances - Start instances
USAGE:
awsm startInstances [arguments...]
ARGUMENTS:
search - The search term for Instance to start
[region] - The region of the instance (optional)
awsm startInstances dev9
This will start the EC2 Instance matching the term dev9
, the output should look similar to this:
$ awsm startInstances dev9
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| NAME | CLASS | PRIVATE IP | PUBLIC IP | INSTANCE ID | AMI | ROOT | SIZE | STATE | KEYPAIR | AVAILABILITY ZONE | VPC | SUBNET | IAM INSTANCE PROFILE |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| dev9 | dev | 10.0.2.117 | | i-05e75f2c3d81b9890 | awsm-init-v3 | ebs | r3.large | stopped | awsm | us-west-2a | us-west-2-vpc | Private | awsm |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
▶ Are you sure you want to start these Instances?
◀ y
△ Started Instance [i-05e75f2c3d81b9890] named [dev9] in [us-west-2a]!
✓ Done!
$ awsm rebootInstances --help
NAME:
awsm rebootInstances - Reboot instances
USAGE:
awsm rebootInstances [arguments...]
ARGUMENTS:
search - The search term for instance to reboot
[region] - The region of the instance (optional)
awsm rebootInstances dev9
This will reboot the EC2 Instance matching the term dev9
, the output should look similar to this:
$ awsm rebootInstances dev9
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| NAME | CLASS | PRIVATE IP | PUBLIC IP | INSTANCE ID | AMI | ROOT | SIZE | STATE | KEYPAIR | AVAILABILITY ZONE | VPC | SUBNET | IAM INSTANCE PROFILE |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| dev9 | dev | 10.0.2.117 | | i-05e75f2c3d81b9890 | awsm-init-v3 | ebs | r3.large | running | awsm | us-west-2a | us-west-2-vpc | Private | awsm |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
▶ Are you sure you want to reboot these Instances?
◀ y
△ Rebooted Instance [i-05e75f2c3d81b9890] named [dev9] in [us-west-2a]!
✓ Done!
$ awsm deregisterInstances --help
NAME:
awsm deregisterInstances - Deregister Instances from SSM Inventory
USAGE:
awsm deregisterInstances [arguments...]
ARGUMENTS:
search - The inventory to search for
[region] - The region of the instance (optional)
awsm deregisterInstances 0dd843fbadcf7fd63
This will deregister the SSM Instance matching the term 0dd843fbadcf7fd63
, the output should look similar to this:
$ awsm deregisterInstances 0dd843fbadcf7fd63
+----------+-------+------------+---------------------+---------------+--------------+---------------+---------------+------------------+---------------+------------------+---------------+
| NAME | CLASS | IP ADDRESS | ENTITY ID | COMPUTER NAME | CAPTURE TIME | PLATFORM NAME | PLATFORM TYPE | PLATFORM VERSION | RESOURCE TYPE | AGENT TYPE | AGENT VERSION |
+----------+-------+------------+---------------------+---------------+--------------+---------------+---------------+------------------+---------------+------------------+---------------+
| dev2-new | dev | 10.1.2.4 | i-0dd843fbadcf7fd63 | dev2 | 6 hours ago | Ubuntu | Linux | 16.04 | EC2Instance | amazon-ssm-agent | 2.0.822.0 |
+----------+-------+------------+---------------------+---------------+--------------+---------------+---------------+------------------+---------------+------------------+---------------+
▶ Are you sure you want to deregister these Instances?
◀ y
△ Deregistered Instance [i-0dd843fbadcf7fd63] named [dev2-new] in [us-east-1]!
✓ Done!
$ awsm getInventory --help
NAME:
awsm getInventory - Get SSM Inventory
USAGE:
awsm getInventory [arguments...]
ARGUMENTS:
[search] - The inventory to search for
awsm getInventory
This will return a list of all of your SSM Inventory, the output should look similar to this:
$ awsm getInventory
+---------------------+---------------------+------------+---------------------+---------------+--------------+---------------+---------------+------------------+---------------+------------------+---------------+
| NAME | CLASS | IP ADDRESS | ENTITY ID | COMPUTER NAME | CAPTURE TIME | PLATFORM NAME | PLATFORM TYPE | PLATFORM VERSION | RESOURCE TYPE | AGENT TYPE | AGENT VERSION |
+---------------------+---------------------+------------+---------------------+---------------+--------------+---------------+---------------+------------------+---------------+------------------+---------------+
| dev11 | dev | 10.0.2.64 | i-0fc6a657c8f693220 | dev11 | 4 days ago | Ubuntu | Linux | 16.04 | EC2Instance | amazon-ssm-agent | 2.0.767.0 |
| i-042853f0d5f06168d | i-042853f0d5f06168d | 10.1.2.213 | i-042853f0d5f06168d | dev99999 | 2 months ago | Ubuntu | Linux | 16.04 | EC2Instance | amazon-ssm-agent | 2.0.730.0 |
| i-05ba04ec81571ad9d | i-05ba04ec81571ad9d | 10.1.2.53 | i-05ba04ec81571ad9d | dev99999 | 2 months ago | Ubuntu | Linux | 16.04 | EC2Instance | amazon-ssm-agent | 2.0.730.0 |
| dev2-new | dev | 10.1.2.4 | i-0dd843fbadcf7fd63 | dev2 | 6 hours ago | Ubuntu | Linux | 16.04 | EC2Instance | amazon-ssm-agent | 2.0.822.0 |
+---------------------+---------------------+------------+---------------------+---------------+--------------+---------------+---------------+------------------+---------------+------------------+---------------+
$ awsm terminateInstances --help
NAME:
awsm terminateInstances - Terminate instances
USAGE:
awsm terminateInstances [arguments...]
ARGUMENTS:
name - The search term for instance to terminate
[region] - The region of the instance (optional)
awsm terminateInstances dev9
This will terminate all EC2 Instances matching the term dev9
, the output should look similar to this:
$ awsm terminateInstances dev9
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| NAME | CLASS | PRIVATE IP | PUBLIC IP | INSTANCE ID | AMI | ROOT | SIZE | STATE | KEYPAIR | AVAILABILITY ZONE | VPC | SUBNET | IAM INSTANCE PROFILE |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
| dev9 | dev | 10.0.2.117 | | i-05e75f2c3d81b9890 | awsm-init-v3 | ebs | r3.large | running | awsm | us-west-2a | us-west-2-vpc | Private | awsm |
+------+-------+------------+-----------+---------------------+--------------+------+----------+---------+---------+-------------------+---------------+---------+----------------------+
▶ Are you sure you want to terminate these Instances?
◀ y
△ Terminated Instance [i-05e75f2c3d81b9890] named [dev9] in [us-west-2a]!
✓ Done!