aws backup vaults

Here’s how to list AWS Backup vaults and plans. You can filter the output by specifying a vault. aws backup list-backup-vaults --query "BackupVaultList[?BackupVaultName=='my-vault']" --output json Output: (outputs are redacted for security reasons) [ { "BackupVaultName": "my-vault", "BackupVaultArn": "arn:aws:backup:us-east-1:xxxxxxxxxxxx:backup-vault:my-vault", "CreationDate": "2019-02-10T11:38:42.556000-05:00", "EncryptionKeyArn": "arn:aws:kms:us-east-1:xxxxxxxxxxxx:key/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "CreatorRequestId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "NumberOfRecoveryPoints": 3 } ] Display the BackupPlanId of a specific backup plan. aws backup list-backup-plans --query "BackupPlansList[?BackupPlanName=='my-backup-plan'].BackupPlanId" Output: (outputs are redacted for security reasons) [ "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" ]

March 5, 2021 · 1 min · ulysses

count string characters

Here’s a simple little script that displays the number of characters in a string. #!/bin/bash if [[ $# -eq 0 ]] ; then echo 'Missing arguments'; exit 0; fi var=$1 size=${#var} echo $size Command: ./length.sh abcdefghijklmnopqrstuvwxyz Output: 26

March 3, 2021 · 1 min · ulysses

aws copy ami to another region

Here’s how to copy an AMI to another region. aws ec2 copy-image \ --source-image-id ami-xxxxxxxxxxx \ --source-region us-east-1 \ --region us-east-2 \ --name "My DR server" Output: { "ImageId": "ami-xxxxxxxxxxx" }

March 2, 2021 · 1 min · ulysses

aws copy snapshot to another region

If you need to copy a snapshot from one region to another, here’s the AWS CLI command. aws ec2 copy-snapshot \ --region us-east-1 \ --source-region us-east-2 \ --source-snapshot-id snap-xxxxxxxxxxxxxxxxx \ --description "This is the DR snapshot copy" Output: { "SnapshotId": "snap-xxxxxxxxxxxxxxxxx" }

March 2, 2021 · 1 min · ulysses

gcp add new route

Here’s how to add a new route in Google Cloud Platform. gcloud compute routes create name-of-new-route \ --destination-range=200.20.0.0/15 \ --next-hop-gateway=default-internet-gateway \ --project=host-project \ --network="default" \ --priority=900

March 2, 2021 · 1 min · ulysses

gcp list of projects

Here’s another way to list projects in a shared VPC. gcloud compute shared-vpc list-associated-resources your-shared-host Output: project1 PROJECT project2 PROJECT project3 PROJECT ...

February 28, 2021 · 1 min · ulysses

gcp list of sql instances

Here’s how to list SQL instances within your GCP project. gcloud sql instances list --project your-project-id Output: NAME DATABASE_VERSION LOCATION TIER PRIMARY_ADDRESS PRIVATE_ADDRESS STATUS database1 SQLSERVER_2017_STANDARD us-central1-a db-n1-standard-1 - 10.10.10.11 RUNNABLE database2 SQLSERVER_2017_STANDARD us-central1-c db-n1-standard-1 - 10.10.10.12 RUNNABLE

February 28, 2021 · 1 min · ulysses

aws list machine images

Here’s how to list AWS AMI (machine images) owned by yourself. aws ec2 describe-images \ --query "Images[*].[Name,PlatformDetails]" \ --owners self \ --profile default \ --region us-east-1 \ --output text Output: icecast-0.1 Linux/UNIX jekyll-0.3 Linux/UNIX docker-0.1 Linux/UNIX Specifying owners as self only display images owned by you.

February 27, 2021 · 1 min · ulysses

disable gutenberg

Two years ago, WordPress introduced Gutenberg block editor together with the release of WordPress version 5.0. Gutenberg essentially became the default editor starting with WordPress version 5.0. While many people love the Gutenberg editor, some people hate it. If you’re one of the many people who hate the Gutenberg editor, you can simply disable it by installing a plugin called Disable Gutenberg. This plugin will revert back to the classic editor. ...

February 27, 2021 · 1 min · ulysses

logging commands

I decided to log my commands for good record keeping. Here’s my script. #!/bin/bash if [[ $# -eq 0 ]] ; then echo 'No arguments. Format: ./go.sh script.sh'; exit 0; fi log=log.txt echo '-------------------------------' >> $log date >> $log echo '---' >> $log cat $1 >> $log echo '---' >> $log /bin/bash $1 2>&1 | tee -a $log To run. ./go.sh script.sh Line by line explanation. Checks for script to run. Exits if there’s no argument. Sets the log file. Prints dashes. Prints the date. Print 3 dashes. Prints the commands to the log file. Print 3 dashes. Run the command. Send error and standard out to log file.

February 22, 2021 · 1 min · ulysses