awscli in docker container

This will download the latest awscli and run it in a container. A new container will be built every time the command is run. Your current credentials in ~/.aws will be used. docker run --rm -it -v ~/.aws:/root/.aws amazon/aws-cli:latest Create an alias for convenience. alias aws='docker run --rm -ti -v ~/.aws:/root/.aws -v $(pwd):/aws amazon/aws-cli' You can now run any aws cli after. aws --version aws-cli/2.2.20 Python/3.8.8 Linux/5.4.0-66-generic docker/x86_64.amzn.2 prompt/off

July 17, 2021 · 1 min · ulysses

bash aliases

Create an alias. alias gcloud='docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk:latest gcloud' Remove an alias. unalias gcloud

July 17, 2021 · 1 min · ulysses

downgrade redhat kernel

How to downgrade a Redhat kernel within the same release. List kernel. yum list kernel-3.10.0-862* yum list kernel-3.10* Install previous kernel if missing. yum install kernel-3.10.0-862.el7 Downgrade to next minor release. yum downgrade redhat-release

July 17, 2021 · 1 min · ulysses

gcloud in a docker container

You can run a gcloud commands in a Docker container. docker run -ti --name gcloud-config google/cloud-sdk gcloud auth login Create an alias. alias gcloud='docker run --rm -ti --volumes-from gcloud-config google/cloud-sdk:latest gcloud' Run the command. gcloud --version Google Cloud SDK 348.0.0 alpha 2021.07.09 app-engine-go 1.9.71 app-engine-java 1.9.90 app-engine-python 1.9.93 app-engine-python-extras 1.9.93 beta 2021.07.09 bigtable bq 2.0.70 cbt 0.10.0 cloud-datastore-emulator 2.1.0 cloud-firestore-emulator 1.13.0 cloud-spanner-emulator 1.2.0 core 2021.07.09 datalab 20190610 gsutil 4.65 kpt 0.39.3 local-extract 1.2.0 pubsub-emulator 0.4.1 Create one for gsutil. ...

July 17, 2021 · 1 min · ulysses

terraform in a docker container

Run Terraform in a Docker container. docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest Create an alias. alias terraform='docker run --rm -it --name terraform -v ~/.aws:/root/.aws -v $(pwd):/workspace -w /workspace hashicorp/terraform:latest' Run the command terraform --version Terraform v1.0.2 on linux_amd64

July 17, 2021 · 1 min · ulysses

ubuntu check reboot required

Check if reboot is required in Ubuntu. at /var/run/reboot-required *** System restart required ***

July 17, 2021 · 1 min · ulysses

check reboot after updates

Here’s the command to check if the system needs a reboot after running yum update. Must be root or run it sudo. $ needs-restarting -r ; echo $? Core libraries or services have been updated: openssl-libs -> 1:1.0.2k-21.el7_9 kernel -> 3.10.0-1160.31.1.el7 dbus -> 1:1.10.24-15.el7 linux-firmware -> 20200421-80.git78c0348.el7_9 glibc -> 2.17-324.el7_9 systemd -> 219-78.el7_9.3 Reboot is required to ensure that your system benefits from these updates. More information: https://access.redhat.com/solutions/27943 1 In this instance, it requires a reboot due to a new kernel.

July 16, 2021 · 1 min · ulysses

gcp rename vm

There’s a new beta command to rename a GCP VM. You must stop instance first. gcloud compute instances stop server-name \ --zone us-central1-c \ --project your-project-id Rename the instance. gcloud beta compute instances set-name old-server-name \ --new-name=new-server-name \ --zone us-central1-c \ --project your-project-id Start the instance. gcloud compute instances start server-name \ --zone us-central1-c \ --project your-project-id Login. gcloud compute ssh server-name \ --zone us-central1-c \ --project your-project-id \ --internal-ip &

July 16, 2021 · 1 min · ulysses

gcp ssh issues return code [1]

If you are getting this return code [1] error, check if enable-oslogin metadata is set to TRUE in your VM. Here’s the error when logging in. gcloud compute ssh your-server-name \ --zone us-central1-a \ --project your-project-id \ --internal-ip & ERROR: (gcloud.compute.ssh) [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\sdk\plink.exe] exited with return code [1]. Remove metadata. gcloud compute instances remove-metadata your-server-name \ --keys=enable-oslogin \ --zone us-central1-a \ --project your-project-id Updated [https://www.googleapis.com/compute/v1/projects/your-project-id/zones/us-central1-a/instances/your-server-name]. Run gcloud ssh again. gcloud compute ssh your-server-name \ --zone us-central1-a \ --project your-project-id \ --internal-ip & [1] 1257 This time it opens up a Putty session and you’re able to login.

July 16, 2021 · 1 min · ulysses

resizing xfs root partition in gcp

How to resize a root partition in GCP. Increase disk size. gcloud compute disks resize server-boot-disk-name \ --size=50GB \ --zone us-central1-c \ --project your-project-id Run growpart. growpart /dev/sda 1 Run xfs_growfs. xfs_growfs /dev/sda1 To verify, run these. lsblk df -Th

July 16, 2021 · 1 min · ulysses