gcp sdk auth login

Here’s how to login to GCP from Google SDK. gcloud auth login Click on the URL to authenticate on your browser. Login with your Google Account. Use MFA if prompted. Click Allow when prompted. You will then be taken to a page that you have successfully logged in.

December 24, 2019 · 1 min · ulysses

aws efs /etc/fstab

To automatically mount a EFS volume after each reboot, you’ll need to add the following format to /etc/fstab. You can use the DNS name given by AWS. fs-12345678:/ /mnt/efs efs defaults,_netdev 0 0 Or the IP address. 10.0.0.22:/ /mnt/efs efs defaults,_netdev 0 0 Mount all with fake and verbose. mount -fav

December 23, 2019 · 1 min · ulysses

gcp setup nlb

Here’s how to setup a Network Load Balancer in GCP. Setup your instances. # Instance 1 gcloud compute instances create www1 \ --image-family debian-9 \ --image-project debian-cloud \ --zone us-central1-b \ --tags network-lb-tag \ --metadata startup-script="#! /bin/bash sudo apt-get update sudo apt-get install apache2 -y sudo service apache2 restart echo '<h1>www1</h1>' | tee /var/www/html/index.html EOF" # Instance 2 gcloud compute instances create www2 \ --image-family debian-9 \ --image-project debian-cloud \ --zone us-central1-b \ --tags network-lb-tag \ --metadata startup-script="#! /bin/bash sudo apt-get update sudo apt-get install apache2 -y sudo service apache2 restart echo '<h1>www2</h1>' | tee /var/www/html/index.html EOF" # Instance 3 gcloud compute instances create www3 \ --image-family debian-9 \ --image-project debian-cloud \ --zone us-central1-b \ --tags network-lb-tag \ --metadata startup-script="#! /bin/bash sudo apt-get update sudo apt-get install apache2 -y sudo service apache2 restart echo '<h1>www3</h1>' | tee /var/www/html/index.html EOF" Create a firewall to allow external traffic to reach port 80. ...

December 23, 2019 · 2 min · ulysses

aws cli iam keys

Here’s a few commands to create, delete and disable AWS user keys. List user keys. aws iam list-access-keys --user-name john.doe Create access key. Results are printed on screen in JSON format. aws iam create-access-key --user-name john.doe Disable a key. The real key id is obfuscated. aws iam update-access-key \ --access-key-id ******************** \ --status Inactive \ --user-name john.doe Delete a key. They real key id is obfuscated. aws iam delete-access-key \ --access-key-id ******************** \ --user-name john.doe

December 20, 2019 · 1 min · ulysses

aws s3 replication policy

Here’s the policy for S3 replication between regions. { "Version": "2012-10-17", "Statement": [ { "Action": [ "s3:Get*", "s3:ListBucket" ], "Effect": "Allow", "Resource": [ "arn:aws:s3:::source-bucket-name", "arn:aws:s3:::source-bucket-name/*" ] }, { "Action": [ "s3:ReplicateObject", "s3:ReplicateDelete", "s3:ReplicateTags", "s3:GetObjectVersionTagging" ], "Effect": "Allow", "Resource": "arn:aws:s3:::destination-bucket-name/*" } ] }

December 20, 2019 · 1 min · ulysses

use curl on load balancers

You can use the curl command to test if your load balancer is working as expected. The curl command will alternately and randomly access several instances in your load balancer. If you have 3 instances behind your load balancer, it will be cycled across all 3. The -m1 command means max time is set to 1 second. while true; do curl -m1 [IP_ADDRESS]; done

December 18, 2019 · 1 min · ulysses

gcp move instance to another zone

Moving a GCP instance to another zone is actually much simpler than initially thought. It’s just a single gcloud command. gcloud compute instances move instance-name \ --zone us-central1-a \ --destination-zone us-central1-b A few details about moving to another zone. VM has to be running. You may get a new internal or external IP address Local SSDs are ephemeral, so you can’t move them. When moving between regions, you may have to select a subnetwork. You may have to change GPUs available in the destination if you use them.

December 13, 2019 · 1 min · ulysses

which java version

Here’s a quick way how to find which Java version you are running. which java java -version

December 13, 2019 · 1 min · ulysses

gcp move instance to another project

Here’s how to copy a disk from one project to another. gcloud compute disks create lamp-server \ --source-snapshot https://www.googleapis.com/compute/v1/projects/project-id/global/snapshots/lamp-server \ --project next-project-id \ --zone us-central1-a Once all the disks are copied. You can create a snapshot of the boot. gcloud compute disks snapshot lamp-server Create an instance from snapshot. gcloud compute disks create "hostname-boot" \ --project "project-id" \ --zone "us-central1-a" \ --source-snapshot "snapshot-name" \ --type "pd-standard" \ --size "100"

December 11, 2019 · 1 min · ulysses

get-hotfix

How to find out if a Windows Server was last patched. From Powershell, run this command. get-hotfix From the command line, run this command. C:\> systeminfo.exe Or from the menu, follow these steps. Open the Windows Settings UI. Click on Update & security. Click on the "Update history" link located under the Windows Update tab.

December 10, 2019 · 1 min · ulysses