This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.8' | |
services: | |
cadvisor: | |
image: gcr.io/cadvisor/cadvisor:latest | |
restart: always | |
volumes: | |
- /:/rootfs:ro | |
- /var/run:/var/run:ro | |
- /sys:/sys:ro | |
- /var/lib/docker/:/var/lib/docker:ro |
-
Ensure a docker-compose.yml file exists inside a
codimd
directory. -
Put the restore.sh script near it.
-
Follow the script below:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Providers :- discover the services that live on your infrastructure (their IP, health, ...) | |
# Entrypoints :- listen for incoming traffic (ports, ...) | |
# Routers :- analyse the requests (host, path, headers, SSL, ...). A router is in charge of connecting incoming requests to the services that can handle them. | |
# Services :- forward the request to your services (load balancing, ...). The Services are responsible for configuring how to reach the actual services that will eventually handle the incoming requests. | |
# Middlewares :- may update the request or make decisions based on the request (authentication, rate limiting, headers, ...) | |
version: "3.7" | |
networks: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
traefik_v2.0: | |
image: 'traefik:2.2' | |
container_name: traefik_v2 | |
hostname: traefik_v2 | |
ports: | |
- '443:443' | |
- '80:80' | |
- '8080:8080' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import boto3 | |
import argparse | |
import json | |
# `pip install -U PTable` will get you the right fork of PrettyTable | |
from prettytable import PrettyTable | |
from botocore.exceptions import ClientError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
groups: | |
- name: example | |
rules: | |
# Alert for any cluster that has average CPU idle < 50% | |
- alert: HighUsage | |
expr: avg(irate(node_cpu_seconds_total{mode="idle"}[1m]) * 100) < 50 | |
for: 1m | |
annotations: | |
summary: "High usage on {{ $labels.instance }}" | |
description: "{{ $labels.instance }} has a average CPU idle (current value: {{ $value }}s)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"agent": { | |
"metrics_collection_interval": 10, | |
"logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log" | |
}, | |
"metrics": { | |
"metrics_collected": { | |
"cpu": { | |
"resources": [ | |
"*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
##### USE ON YOUR OWN RISK - THIS IS GOING TO DEREGISTER AMI OLDER THAN 30 DAYS | |
import boto3 | |
from dateutil.parser import parse | |
import datetime | |
age = 30 | |
aws_profile_name = 'prod' | |
def days_old(date): | |
get_date_obj = parse(date) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
curl https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonEC2/current/index.json | jq -r '.products[].attributes["instanceType"]' | sort -u | grep '\.' | |
NewerOlder