Show Menu
Cheatography

CoreOS and EC2 Cheat Sheet by

Legend

Local command
Remote command

Cluster Management

Listing machines
fleetctl list-m­ach­ines
Submit new unit file
fleetctl submit myapp@.se­rvice
List submitted unit files
fleetctl list-u­nit­-files
List units and their status
fleetctl list-u­nits
Star­t/stop units
fleetctl start myapp@1                             fleetctl stop myapp@1
Removing unit files
fleetctl unload myapp@1                           fleetctl destroy myapp@1.service             fleetctl destroy myapp@.se­rvice
Opening a remote shell (*)
fleetctl ssh myapp@1
Insp­ecting the logs (*)
fleetctl journal --line­s=100 myapp@1
Log monitoring (*)
fleetctl journal -f myapp@1
Each command must specify an etcd endpoint (--en­dpo­int­=ht­tp:­//1.2.3.4­:40­01). This can be the IP address of any machine in the cluster.

(*) A running SSH agent is required for these commands.
 

Unit Management

Stop unit
sudo systemctl restart myapp@1
Start unit
sudo systemctl start myapp@1
Stop unit
sudo systemctl stop myapp@1
View unit status
sudo systemctl status myapp@1
List active units
sudo systemctl

Container Management

List running contai­ners
docker ps
List all contai­ners
docker ps -a
List images
docker images
Star­t/stop a contai­ner
docker start CONTAINER_ID                        docker stop CONTAI­NER_ID
Create and run a contai­ner
docker run -e FOO=bar IMAGE_ID
Delete a contai­ner
docker rm CONTAI­NER_ID
Delete an image
docker rmi IMAGE_ID
 

Log Management

Inspect unit logs
journ­alctl -u myapp@1
Filter out older log entries
journ­alctl --sinc­e=2­015­-07-03 11:33:­22"
Filter out newer log entries
journ­alctl --unti­l=2­015­-07-03 11:33:­22"

Instance Management

List instan­ces
aws ec2 descri­be-­ins­tances
Stop an instance (*)
aws ec2 stop-i­nst­ances --inst­anc­e-ids ID
Start an instance
aws ec2 start-­ins­tances --inst­anc­e-ids ID
Reboot an instance
aws ec2 reboot­-in­stances --inst­anc­e-ids ID
Term­inate an instance (**)
aws ec2 termin­ate­-in­stances --inst­anc­e-ids ID
The AWS client supports fine-grained output formatting. Use the table format (--output table) and a query string:
--query 'Reser­vat­ion­s[­].I­nst­anc­es[­].[­Ta­gs[­?Ke­y==­`N­ame`] | [0].Value, Instan­ceId, State.N­ame, Placem­ent.Av­ail­abi­lit­yZone]

(*) Data on ephemeral storage (e.g. containers and images) will be lost!

(**) Data on block- (the root file system) and ephemeral storage will be lost!
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.