Skip to content

YeonguChoe/cloud-commands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 

Repository files navigation

Cloud commands

SSH Key Generation

ssh-keygen -b 2048 -f <key>.pem -m PEM -t rsa

Change Permission of SSH Key File

chmod 600 <key>.pem

Connecting to Cloud With SSH

ssh -i ./cloud-key -o PubKeyAcceptedAlgorithms=+ssh-rsa username@hostname
  • If server does not allow ssh-rsa, add -o PubKeyAcceptedAlgorithms=+ssh-rsa
ssh -i ./cloud-key -o PubKeyAcceptedAlgorithms=+ssh-rsa username@hostname

Change Linux User Password

passwd

Upload file to Remote Server

scp -i <ssh-key> <file-to-upload> <username>@<host>:<path>

Compress folder with LZ4

tar --use-compress-program=lz4 -cf <file-name>.tar.lz4 <folder-name>/

Decompress folder with LZ4

tar --use-compress-program=lz4 -xf <file-name>.tar.lz4

GCP

Login related

  • Login
gcloud auth login
  • List logged-in accounts
gcloud auth list
  • Logout
gcloud auth revoke <ACCOUNT>

Project related

  • List existing projects
gcloud projects list
  • Check selected project
gcloud config get project
  • Change selected project
gcloud config set project <PROJECT_ID>

SSH connection

  • Check existing instances
gcloud compute instances list
  • Connect to instance
gcloud compute ssh <NAME>@<INSTANCE_NAME> --zone=<ZONE>
  • Disconnect SSH connection
exit
  • Add SSH login credential to $HOME/.ssh/config
gcloud compute config-ssh

Instance

  • Boot instance
gcloud compute instances start <INSTANCE_NAME>
  • Shutdown instance
gcloud compute instances stop <INSTANCE_NAME>
  • Reboot instance
gcloud compute instances reset <INSTANCE_NAME>

AWS

Upload file from EC2 to S3

aws s3 cp <file> s3://<bucket>/<folder>/<file>

Download file from S3 to EC2

aws s3 cp s3://<bucket>/<folder>/<file> .

About

Useful cloud commands

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors