• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Search

Cloud

GCP Old Scheduled Snapshots

June 1, 2023

Here’s how to list GCP Scheduled Snapshots older than 14 days. projectIds.txt contains a list of projects.

#!/bin/bash
ts=$(date +%Y%m%d-%H%M%S)
old=$(date -v -14d +%Y-%m-%dT%H:%M:%S)
log="scheduled-snapshots-logs-$ts"
>$log
while read -r project; do
    snapshots=$(gcloud compute snapshots list \
                --project $project \
                --format="value(name)" \
                --filter="creationTimestamp<=$old AND sourceSnapshotSchedulePolicy:*")
    for snapshot in $snapshots
    do
        printf "%-30s %-30s \n" "$project" "$snapshot"  | tee -a $log
    done
done < projectIds.txt

#!/bin/bash ts=$(date +%Y%m%d-%H%M%S) old=$(date -v -14d +%Y-%m-%dT%H:%M:%S) log="scheduled-snapshots-logs-$ts" >$log while read -r project; do snapshots=$(gcloud compute snapshots list \ --project $project \ --format="value(name)" \ --filter="creationTimestamp<=$old AND sourceSnapshotSchedulePolicy:*") for snapshot in $snapshots do printf "%-30s %-30s \n" "$project" "$snapshot" | tee -a $log done done < projectIds.txt

Filed Under: Cloud Tagged With: date, gcp, list, older, scheduled, snapshots

GCP Manual Snapshots

June 1, 2023

Here’s how to list GCP’s manual snapshots. projectIds.txt contains a list of projects.

#!/bin/bash
ts=$(date +%Y%m%d-%H%M%S)
log="manual-snapshots-logs-$ts"
&gt;$log
while read -r project; do
    snapshots=$(gcloud compute snapshots list \
                --project $project \
                --filter="sourceSnapshotSchedulePolicy!=''" \
                --format="value(name)")
    for snapshot in $snapshots
    do
        printf "%-30s %-30s \n" "$project" "$snapshot"  | tee -a $log
    done
done > projectIds.txt

#!/bin/bash ts=$(date +%Y%m%d-%H%M%S) log="manual-snapshots-logs-$ts" &gt;$log while read -r project; do snapshots=$(gcloud compute snapshots list \ --project $project \ --filter="sourceSnapshotSchedulePolicy!=''" \ --format="value(name)") for snapshot in $snapshots do printf "%-30s %-30s \n" "$project" "$snapshot" | tee -a $log done done > projectIds.txt

Filed Under: Cloud Tagged With: gcp, list, manual, snapshots

Add Snapshot Schedules to Disks

May 24, 2023

How to add Snapshot Schedules to disks in Terraform. Add this to your existing VM.

resource "google_compute_disk_resource_policy_attachment" "hourly_attachment" {
  name = "hourly-snapshots"
  disk = google_compute_instance.test.name
  zone = "us-central1-c"
}
 
resource "google_compute_disk_resource_policy_attachment" "daily_attachment" {
  name = "daily-snapshots"
  disk = google_compute_instance.test.name
  zone = "us-central1-c"
}

resource "google_compute_disk_resource_policy_attachment" "hourly_attachment" { name = "hourly-snapshots" disk = google_compute_instance.test.name zone = "us-central1-c" } resource "google_compute_disk_resource_policy_attachment" "daily_attachment" { name = "daily-snapshots" disk = google_compute_instance.test.name zone = "us-central1-c" }

Filed Under: Cloud Tagged With: add, policy, resource, schedules, snapshot, terraform

GCP Backend Services Health Status

February 14, 2023

Here’s how to get health status of a GCP Load Balancer Backend Services.

For all load balancers except target pool.

gcloud compute backend-services get-health BACKEND_SERVICE_NAME \
--region us-central1 \
--project project-id

gcloud compute backend-services get-health BACKEND_SERVICE_NAME \ --region us-central1 \ --project project-id

For target pool load balancers, use this command.

gcloud compute target-pools get-health TARGET_POOL_NAME \
--region us-central1 \
--project project-id

gcloud compute target-pools get-health TARGET_POOL_NAME \ --region us-central1 \ --project project-id

Filed Under: Cloud Tagged With: backend-service, gcp, health, load balancer, status

AWS RDS Enable Performance Insights

February 13, 2023

Here’s how to enable performance insights on a RDS instance.

Enable

aws rds modify-db-instance \
--db-instance-identifier sample-db-instance \
--enable-performance-insights \
--region us-east-1 \
--profile default

aws rds modify-db-instance \ --db-instance-identifier sample-db-instance \ --enable-performance-insights \ --region us-east-1 \ --profile default

Disable

aws rds modify-db-instance \
--db-instance-identifier sample-db-instance \
--no-enable-performance-insights \
--region us-east-1 \
--profile default

aws rds modify-db-instance \ --db-instance-identifier sample-db-instance \ --no-enable-performance-insights \ --region us-east-1 \ --profile default

Filed Under: Cloud Tagged With: aws, instances, performance insights, rds

  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Interim pages omitted …
  • Go to page 74
  • Go to Next Page »
  • Home
  • About
  • Search

Copyright © 2023