Skip to content

Instantly share code, notes, and snippets.

View cdechery's full-sized avatar
👀
Is CloudFormation considered coding? If so, I code a lot!

Christian Dechery cdechery

👀
Is CloudFormation considered coding? If so, I code a lot!
View GitHub Profile
@cdechery
cdechery / helloworld-lambda.yml
Created November 28, 2022 13:33
Having trouble creating Lambdas due to proxy related issues? This template might help.
########
# Deploys a "Hello World" Lambda Function
# @createdby Christian Dechery
# @date 25-nov-2022
########
AWSTemplateFormatVersion: "2010-09-09"
Description: Deploys a very basic "Hello World" Lambda function
@cdechery
cdechery / cfn-cmdline-gen.py
Last active November 21, 2022 19:25
CloudFormation command line generator from template
# You need to install cfn-tools with "pip install cfn_flip"
import sys
from cfn_tools import load_yaml
try:
INPUT_FILE = sys.argv[1]
except Exception as e:
print('No input file!\nUsage: python cfn-cmdline-gen.py template.yml [separator-char]')
exit(1)
@cdechery
cdechery / envinspect.config
Created May 16, 2018 19:04
Retreive Beanstalk Application name from within EC2 instance
packages:
yum:
jq: []
container_commands:
01-getenv-info:
command: |
ENV_ID=`{"Ref": "AWSEBEnvironmentId" }`
ENV_NAME=`{"Ref": "AWSEBEnvironmentName" }`
echo "env.id="$ENV_ID > /tmp/awseb.properties
@cdechery
cdechery / s3edit.sh
Created May 16, 2018 12:11
Edit text files on S3
#!/bin/sh
set -e
FILE=$(basename $1)
aws s3 cp "s3:/"$1 .
nano $FILE
read -p "Atualizar no S3? [s/n] " -n 1 -r
@cdechery
cdechery / get_ebenvs_ips.sh
Created November 17, 2017 18:38
A simple shell script that obtains de IP from all the instances of ElasticBeanstalk apps/envs and adds them to the /etc/hosts of a server.
#!/bin/sh
####################################################
# por: Christian Dechery
# objetivo: obtem os enderecos IP de todas as instancias de aplicacoes
# rodando no ElasticBeanstalk
###################################################
envs=("tecvirt" "hmlg" "mock" "hmlg2" "prod")
cat base_hosts > new_hosts