Skip to content

Instantly share code, notes, and snippets.

View brunodasilvalenga's full-sized avatar

Bruno da Silva Valenga brunodasilvalenga

View GitHub Profile
variable "aws_account_id" {}
variable "aws_role" {}
variable "org_name" {
default = "example"
}
locals {
env = {
nonprod-ap-southeast-2-dev = {
image: dnxsolutions/musketeers:1.1.1-ecr
services:
- docker:18.03.1-ce-dind # needs to match gitlab runner version
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
BUILD_VERSION: $CI_COMMIT_SHORT_SHA
AWS_ROLE: ci-deploy
AWS_DEFAULT_REGION: ap-southeast-2
image: dnxsolutions/musketeers:1.1.1-ecr
services:
- docker:18.03.1-ce-dind # needs to match gitlab runner version
variables:
DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
AWS_DEFAULT_REGION: ap-southeast-2
AWS_HOSTED_ZONE: dev.cloud.example.com.au
@brunodasilvalenga
brunodasilvalenga / get_spot_price.py
Created June 4, 2020 06:49
Script python to get spot price with last 4 hours.
import boto3
import datetime
client = boto3.client('ec2', region_name='us-west-2')
regions = [x["RegionName"] for x in client.describe_regions()["Regions"]]
print(regions)
INSTANCE = "t3.xlarge"
print("Instance: %s" % INSTANCE)
results = []
for region in regions:
client = boto3.client('ec2', region_name=region)
@brunodasilvalenga
brunodasilvalenga / rds_restore_from_snapshopt.sh
Created March 23, 2022 20:24
Create RDS Snapshot and restore it.
#!/bin/bash
# set up some variables
NOW_DATE=$(date '+%Y-%m-%d-%H-%M')
RESTORE_FROM_INSTANCE_ID=<source name>
TARGET_INSTANCE_ID=<target name>
TARGET_INSTANCE_CLASS=db.m4.large
VPC_ID=<vpc subnet id>
NEW_MASTER_PASS=<root password>
#!/bin/bash
# Set output file
report_file="aws_network_report_$(date +%Y%m%d_%H%M%S).txt"
echo "AWS Network Infrastructure Report" > "$report_file"
echo "Generated on: $(date)" >> "$report_file"
echo "========================================" >> "$report_file"
# First, let's get Transit Gateways information