CoreOS and EC2 Cheat Sheet

A cheat sheet in English by protomouse
12,446 views 3,702 downloads 6 May 2015 History
4.3 avg · 1 rating

Legend

Local command
Remote command

Cluster Management

Listing machines
fleetctl list-m­achines
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-units
Start/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
Inspecting the logs (*)
fleetctl journal --line­s=100 myapp@1
Log monitoring (*)
fleetctl journal -f myapp@1
Each command must specify an etcd endpoint (--endp­oin­t=h­ttp­://­1.2.3.4­:4001). 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 containers
docker ps
List all containers
docker ps -a
List images
docker images
Start/stop a container
docker start CONTAI­NER_ID ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­ ­  docker stop CONTAI­NER_ID
Create and run a container
docker run -e FOO=bar IMAGE_ID
Delete a container
docker rm CONTAI­NER_ID
Delete an image
docker rmi IMAGE_ID

Log Management

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

Instance Management

List instances
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
Terminate an instance (**)
aws ec2 termin­ate­-in­stances --inst­anc­e-ids ID
The AWS client supports fine-g­rained output formatting. Use the table format (--output table) and a query string:
--query '­Res­erv­ations[].Inst­ances[].[Tag­s[?­Key­==`­Name`] | [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!

Badges

Good Cheat Sheet Nice Cheat Sheet

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.