Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View exequielrafaela's full-sized avatar
💭
☕ if(infra == code){return true}

Exequiel Barrirero exequielrafaela

💭
☕ if(infra == code){return true}
View GitHub Profile
@exequielrafaela
exequielrafaela / resolvd-switch.sh
Last active July 8, 2022 12:45
Linux mint / ubuntu resolvd switcher bash script
#!/bin/bash
# When using Linux mint/ubuntu Pritunl VPN client and can't resolve endpoints, a solution is to kill resolvd.
# As the whole process is a couple of steps this script will solve it for your.
# It is called with --stop to kill resolvd or with --start to resume the previous state.
# Check if running as root
if [[ $EUID -ne 0 ]]; then
echo "Must be running as root"
exit
#!/bin/bash
#### Pre-requisites
## NOTE: You need to install the SSM plugin for the AWS CLI
## https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html
#### Variables initialization
PROJECT_SHORT="bb"
FOLDER="le-tf-infra-aws"
COMMON_CONFIG_FILE="$FOLDER/config/common.tfvars"
@exequielrafaela
exequielrafaela / aws_create_users_ubuntu.sh
Created December 17, 2021 14:49 — forked from vasansr/aws_create_users_ubuntu.sh
AWS User Data Script to create users when launching an Ubuntu server EC2 instance
#!/bin/bash
#
# Initial script to create users when launching an Ubuntu server EC2 instance
#
declare -A USERKEY
#
# Create one entry for every user who needs access. Be sure to change the key to their
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
"AWS Services","Key Points"
"AWS Backup","AWS Backup is a centralised backup service that makes it easy and cost-effective for you to backup your application data across AWS services in the AWS Cloud, helping you meet your business and regulatory backup compliance requirements.You should use AWS Backup to manage and monitor backups across the AWS services you use, from a single place.Services supported:EBS (it leverages EBS Snapshots)RDS (it supports RDS Aurora Automated Backups and RDS Snapshots)EFS (transition to cold storage is supported for this service)DynamoDBFSxStorage Gateway.You pay for the amount of backup storage you use and the amount of backup data you restore in the month. [*]"
"AWS Data Lifecycle Manager","DLM provides a simple way to manage the lifecycle of EBS resources, such as volume snapshots.You should use DLM when you want to automate the creation, retention, and deletion of EBS snapshots.It is simple to implement. Once set up, it can be monitored easily through CloudWatch.Pricing is mod
@exequielrafaela
exequielrafaela / aws_s3_storage_bucket.tf
Last active October 6, 2020 15:34
AWS S3 Secure Multipurpose Storage Bucket
#
## Examples
# - Complete | https://github.com/binbashar/terraform-aws-s3-bucket/tree/master/examples/complete
# - Replication | https://github.com/binbashar/terraform-aws-s3-bucket/tree/master/examples/s3-replication
#
#=============================#
# Module Instanciation #
#=============================#
module "s3_bucket" {
@exequielrafaela
exequielrafaela / aws-s3api-delete-objects-from-aws-s3api-list.sh
Last active October 6, 2020 15:39
aws s3api delete-objects from aws s3api list
AWS_SHARED_CREDENTIALS_FILE="/home/user/.aws/test/credentials" \
AWS_CONFIG_FILE="/home/user/.aws/test/config" \
aws s3api delete-objects \
--profile test-shared-devops \
--bucket test-shared-gdrive-backup \
--delete \
"$(AWS_SHARED_CREDENTIALS_FILE="/home/user/.aws/test/credentials" AWS_CONFIG_FILE="/home/user/.aws/test/config" aws s3api list-object-versions \
--profile test-shared-devops \
--bucket test-shared-gdrive-backup | jq '{Objects: [.Versions[] | {Key:.Key, VersionId : .VersionId}], Quiet: false}')"
@exequielrafaela
exequielrafaela / gh-pages-deploy.md
Created August 5, 2020 18:36 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "MultiServiceFullAccessCustom",
"Effect": "Allow",
"Action": [
"ec2:*",
"rds:*"
],
@exequielrafaela
exequielrafaela / aws_cloudfront_no_origin_s3_restriction_test.sh
Last active November 24, 2023 14:54
Scurity & Audit Bash script functions based on awscli to get differente AWS services information for different scenarios
#!/usr/bin/env bash
#
# AWS ENV vars for your project (https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html)
#
# AWS_PROFILE – Specifies the name of the CLI profile with the credentials and options to use.
# This can be the name of a profile stored in a credentials (~/.aws/credentials) or config (~/.aws/config)
# file, or the value default to use the default profile. If you specify this environment variable,
# it overrides the behavior
# of using the profile named [default] in the configuration file.
@exequielrafaela
exequielrafaela / prometheus.yml
Created October 17, 2019 23:21 — forked from reachlin/prometheus.yml
sample prometheus configuration explained
// For all the confusing Prometheus configuration and
// regular expressions,
// explained in examples.
// Remember, there are default values for each item if it's missing.
// regex is (.*),
// replacement is $1,
// separator is ;
// ,and action is replace