How to look for an access key in AWS. Find the account.
$ aws sts get-access-key-info --access-key-id AKIA8XXXXXXXXXXXXXXX { "Account": "XXXXXXXXXXXX" } |
cloud engineer
How to look for an access key in AWS. Find the account.
$ aws sts get-access-key-info --access-key-id AKIA8XXXXXXXXXXXXXXX { "Account": "XXXXXXXXXXXX" } |
$ aws sts get-access-key-info --access-key-id AKIA8XXXXXXXXXXXXXXX { "Account": "XXXXXXXXXXXX" }
How to create service account in GCP via Terraform.
provider "google" { project = "your_project_id" } resource "google_service_account" "service_account" { account_id = "your-service-account-name" display_name = "test service account built by terraform" } |
provider "google" { project = "your_project_id" } resource "google_service_account" "service_account" { account_id = "your-service-account-name" display_name = "test service account built by terraform" }
Here’s a script to convert date to epoch time on Mac OS.
#!/bin/bash if [[ -z $1 ]]; then echo "Format: date2epoch.sh 2022/01/01-04:58:06" else echo "$1"; date -j -f date -j -f "%Y/%m/%d-%T" "$1" +"%s" fi |
#!/bin/bash if [[ -z $1 ]]; then echo "Format: date2epoch.sh 2022/01/01-04:58:06" else echo "$1"; date -j -f date -j -f "%Y/%m/%d-%T" "$1" +"%s" fi
Result
$ ./date2epoch.sh 2022/08/31-22:00:00 2022/08/31-22:00:00 1661997600 |
$ ./date2epoch.sh 2022/08/31-22:00:00 2022/08/31-22:00:00 1661997600
Connect to your CloudShell environment from your terminal.
$ gcloud cloud-shell ssh Welcome to Cloud Shell! Type "help" to get started. first.last@cloudshell $ first.last@cloudshell $ |
$ gcloud cloud-shell ssh Welcome to Cloud Shell! Type "help" to get started. first.last@cloudshell $ first.last@cloudshell $
Once logged in, you can set your project.
first.last@cloudshell $ gcloud config set project $PROJECT_ID |
first.last@cloudshell $ gcloud config set project $PROJECT_ID
Here’s how to move a VM to another VPC.
Stop VM.
gcloud compute instances stop $INSTANCE_NAME \ --zone $ZONE_NAME \ --project $PROJECT_ID |
gcloud compute instances stop $INSTANCE_NAME \ --zone $ZONE_NAME \ --project $PROJECT_ID
Move VM to another VPC.
gcloud compute instances network-interfaces update $INSTANCE_NAME \ --zone $ZONE_NAME \ --network-interface=nic0 \ --network $YOUR_NETWORK \ --subnetwork $YOUR_SUBNETWORK \ --project $PROJECT_ID |
gcloud compute instances network-interfaces update $INSTANCE_NAME \ --zone $ZONE_NAME \ --network-interface=nic0 \ --network $YOUR_NETWORK \ --subnetwork $YOUR_SUBNETWORK \ --project $PROJECT_ID
Start VM.
gcloud compute instances start $INSTANCE_NAME \ --zone $ZONE_NAME \ --project $PROJECT_ID |
gcloud compute instances start $INSTANCE_NAME \ --zone $ZONE_NAME \ --project $PROJECT_ID