Skip to content

Instantly share code, notes, and snippets.

View tanmay-bhat's full-sized avatar

Tanmay Bhat tanmay-bhat

View GitHub Profile
@tanmay-bhat
tanmay-bhat / rds-backup-greater-than-7-days.sh
Created January 10, 2023 15:09
AWS CLI command to list all RDS which has backup retention period greater than 7 days :
aws rds describe-db-instances --query 'DBInstances[?BackupRetentionPeriod>`7`].[DBInstanceIdentifier,BackupRetentionPeriod]' --region <region> --output table
@tanmay-bhat
tanmay-bhat / rds-snapshot-7days-old.sh
Last active January 10, 2023 15:06
AWS CLI command to list all RDS snapshots older than 7 days :
aws rds describe-db-snapshots --query "DBSnapshots[?SnapshotCreateTime<='$(date -v-7d +%Y-%m-%dT%H:%M:%SZ)'].{DBSnapshotIdentifier:DBSnapshotIdentifier, DBInstanceIdentifier:DBInstanceIdentifier,SnapshotCreateTime:SnapshotCreateTime}" --region <region> --output table
@tanmay-bhat
tanmay-bhat / grafana-ha.yaml
Last active August 22, 2022 16:08
Docker compose file to create Grafana containers stack behing Nginx proxy
version: '3'
services:
grafana:
image: grafana/grafana:9.0.7
expose:
- "3000"
environment:
- GF_DATABASE_NAME=grafana
- GF_DATABASE_USER=postgres
- GF_DATABASE_PASSWORD=super-secret-password
@tanmay-bhat
tanmay-bhat / grafana-remote-db.yaml
Last active August 22, 2022 16:07
Docker compose file to create Grafana container that will connect to remote PostgreSQL DB
version: '3'
services:
grafana:
image: grafana/grafana:9.0.7
container_name: grafana
ports:
- 3000:3000
environment:
- GF_DATABASE_NAME=grafana
- GF_DATABASE_USER=postgres
@tanmay-bhat
tanmay-bhat / slack.tmpl
Last active October 8, 2024 21:59
Grafana alert template to display message (alert) in slack
{{ define "alert_severity_prefix_emoji" -}}
{{- if ne .Status "firing" -}}
:white_check_mark:
{{- else if eq .CommonLabels.severity "critical" -}}
:red_circle:
{{- else if eq .CommonLabels.severity "warning" -}}
:warning:
{{- end -}}
{{- end -}}
@tanmay-bhat
tanmay-bhat / list-node.md
Created July 21, 2022 09:07
Kubernetes: List nodes with specific label
kubectl get no -l spotinst.io/node-lifecycle=od

The above will list all the nodes which have label key = spotinst.io/node-lifecycle and value = od

@tanmay-bhat
tanmay-bhat / s3-lifecycle-60-days-delete.md
Created July 20, 2022 07:02
AWS S3 lifecycle policy to delete all files in bucket older than 60 days via CLI
  • Create a file called lifecycle.json and append the below into it :
{
    "Rules": [
        {
            "ID": "Delete files older than 60 days",
            "Prefix": "",
            "Status": "Enabled",
            "Expiration": 
 {
@tanmay-bhat
tanmay-bhat / Exiting due to RSRC_INSUFFICIENT_CORES: Requested cpu count 2 is greater than the available cpus of 1.md
Created June 26, 2022 13:06
solution : ⛔ Exiting due to RSRC_INSUFFICIENT_CORES: Requested cpu count 2 is greater than the available cpus of 1

If you face the below error message while starting minikube with podman as the driver, then follow the below solution :

Error message : Exiting due to RSRC_INSUFFICIENT_CORES: Requested cpu count 2 is greater than the available cpus of 1

Reason : - By default podman creates the VM with 1 vCPU. minikube (Kubernetes) requires minimum 2vCPU

Steps :

  • Stop the existing VM :
podman machine stop
@tanmay-bhat
tanmay-bhat / 1604-solution.md
Created June 18, 2022 08:14
Create and Manage Cloud Resources: Challenge Lab Solution

Create and Manage Cloud Resources: Challenge Lab Solution

Lab Link : Here

Task 1 :

  • Create a project jumphost instance
  • You will use this instance to perform maintenance for the project.

Requirements:

@tanmay-bhat
tanmay-bhat / terraform_problems.md
Last active June 7, 2022 15:41
Jotting down some common terraform error messages one might encounter in their terraform journey.

Jotting down some common terraform error messages one might encounter in their terraform journey.


│   on main.tf line xxx, in resource "google_compute_global_address" "xxx":
│  region = "us-central1"
│ 
│ An argument named "region" is not expected here.