Skip to content

Instantly share code, notes, and snippets.

@mmiranda
mmiranda / aws-launch-instance.rb
Last active October 10, 2017 20:35
This snippet creates an instance on AWS EC2.
# How to execute:
# 1. Make sure you have optparse and aws-sdk gem installed
# 2. Run: ruby aws-launch-instance.rb -a YOUR-ACCESS_KEY -s YOUR-SECRET-KEY -r eu-central-1 -t t2.micro
require 'optparse'
require 'aws-sdk'
# Collect parameters
options = {}
optparse = OptionParser.new do |opts|
### Keybase proof
I hereby claim:
* I am mmiranda on github.
* I am mateusmiranda (https://keybase.io/mateusmiranda) on keybase.
* I have a public key ASBhW_HTCTME-V4m2Fj5MA9w5-PR0qca92uvP40siEazygo
To claim this, I am signing this object:
global
log 127.0.0.1 local2 info
maxconn 4096
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
stats socket /var/lib/haproxy/stats mode 600 level admin
stats timeout 30m
user haproxy
group haproxy
daemon
@mmiranda
mmiranda / route53-terraform.sh
Created January 7, 2021 13:27
Compare AWS Route53 records with Terraform state
#!/bin/bash
###################################################################
#Script Name : route53-terraform-compare
#Description : Compare both Route53 records and Terraform state and check what is missing in state
#Args : -z ZONE_ID -p /path/to/tf-state
#Author : Mateus Miranda
#Email : mateusmiranda@gmail.com
###################################################################
@mmiranda
mmiranda / example.md
Last active December 3, 2021 13:38
Mirror Markdown to Confluence

Your markdown content

Check metadata info on RAW version

@mmiranda
mmiranda / ecr-policy.tf
Created June 17, 2022 08:57
ECR Access from differents organizations
// Grant Read Only access to all account inside AWS organization
data "aws_iam_policy_document" "ecr_organization_readonly_access" {
statement {
sid = "ReadonlyAccess"
effect = "Allow"
principals {
type = "*"
identifiers = ["*"]
}