Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
## Delete the Default VPC across all AWS Regions
## So its only used the ones that the team creates and there are no potential problems
## using others and exposing apps
for region in $(aws ec2 describe-regions --region eu-west-1 | jq -r .Regions[].RegionName); do
echo "* Region ${region}"
@enriquemanuel
enriquemanuel / testscp.json
Last active June 30, 2021 15:45
dummy file
{
"Version": "2012-10-17",
"Statement": [{
"NotAction": ["*:*"],
"Resource": "*",
"Effect": "Deny",
"Condition": {
"StringNotEquals": {
"aws:RequestedRegion": ["us-east-1"]
},
@enriquemanuel
enriquemanuel / config.ini
Last active August 21, 2021 21:54
this is a serverless project that is used to launch an EC2 instance and configure Jenkins using JCASC plugin that is stored in a repo so its cloned and it gets copied to the EC2 accordingly
[DEFAULT]
instance_type = t3.xlarge
security_groups = sg-1234
iam_role = iam-role
subnet_id = subnet-id
target_group_arn = arn:<aws>:elasticloadbalancing:<region>:<accountid>:targetgroup/<id>
[ebs]
device_name = /dev/xvda
delete_on_termination = True
@enriquemanuel
enriquemanuel / me.jenkinsfile
Created August 19, 2020 12:38
build and test jenkins
#!/usr/bin/env groovy
import jenkins.model.Jenkins
// Variable Definitions
def LOWER_ENVIRONMENTS = ['dev', 'dev1', 'test','stage', 'qa1', 'qa2', 'build'] as List
def HIGHER_ENVIRONMENTS = ['prod', 'production'] as List
// Debug
//def LOWER_ENVIRONMENTS = ['dev', 'dev1', 'test','stage']

Interview Questions

  • You have applied for a DevOps position, why does a company or a team need DevOps?
  • Have you used any Configuration Management tool?
    • Examples: Ansible, Chef, Puppet, Salt
    • tell me more about that experience
    • What was the hardest part?
  • Have you used any Infrastructure as Code tool?
    • Examples: Terraform, Cloudformation
    • Tell me more about that experience
    • What was the hardest part?
@enriquemanuel
enriquemanuel / mfa.sh
Created April 10, 2020 14:19
SocksProxy that uses SSH Config to SSH via SSM to an AWS Instance to not use SSH
#!/bin/bash
bold=$(tput bold)
normal=$(tput sgr0)
USAGE=$(cat <<-END
source ./issue_mfa.sh [AWS_USERNAME] [MFA_TOKEN]
Issues an aws security token and sets it automatically.
If added the -v flag it will echos AWS_SECRET_ACCESS_KEY,
AWS_ACCESS_KEY_ID, AWS_SECURITY_TOKEN, and AWS_SESSION_TOKEN
<Response Destination='https://cf.preprod.ds.va.gov/auth/saml_callback' ID='_0b19690b00569905d6b507c46bddf3ac6a1a' InResponseTo='_cb74f510-1990-4c3c-bf37-50cd7962d771' IssueInstant='2020-03-09T19:06:56Z' Version='2.0' xmlns='urn:oasis:names:tc:SAML:2.0:protocol'>
<ns1:Issuer Format='urn:oasis:names:tc:SAML:2.0:nameid-format:entity' xmlns:ns1='urn:oasis:names:tc:SAML:2.0:assertion'>VA_SSOi_IDP</ns1:Issuer><ds:Signature xmlns:ds='http://www.w3.org/2000/09/xmldsig#'>
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm='http://www.w3.org/2001/10/xml-exc-c14n#'/>
<ds:SignatureMethod Algorithm='http://www.w3.org/2001/04/xmldsig-more#rsa-sha256'/>
<ds:Reference URI='#_0b19690b00569905d6b507c46bddf3ac6a1a'>
<ds:Transforms>
<ds:Transform Algorithm='http://www.w3.org/2000/09/xmldsig#enveloped-signature'/>
<ds:Transform Algorithm='http://www.w3.org/2001/10/xml-exc-c14n#'/>
</ds:Transforms>

Keybase proof

I hereby claim:

  • I am enriquemanuel on github.
  • I am enriquemanuel (https://keybase.io/enriquemanuel) on keybase.
  • I have a public key ASDG5GCPQd1_sBs0yq5PM-xffbYCvoiaCcnOsf5VMCUVSQo

To claim this, I am signing this object:

@enriquemanuel
enriquemanuel / demo.logs
Created December 19, 2019 02:40
500 error in docker demo
appeals-app | [caseflowdemo.com] [f7ea34d9-f2dc-46eb-ab9d-c14f5a2b1973] [localhost] [BVAAABSHIRE ] Started GET "/tasks?user_id=3&role=Judge" for 74.96.204.56 at 2019-12-19 02:39:56 +0000
appeals-app | [2019-12-19 02:39:57 +0000] Processing by TasksController#index as HTML
appeals-app | [2019-12-19 02:39:57 +0000] Parameters: {"user_id"=>"3", "role"=>"Judge"}
appeals-app | [2019-12-19 02:39:57 +0000] User Load (0.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT $2 [["id", 3], ["LIMIT", 1]]
appeals-app | [2019-12-19 02:39:57 +0000] (0.9ms) BEGIN
appeals-app | [2019-12-19 02:39:57 +0000] SQL (0.4ms) UPDATE "users" SET "last_login_at" = $1, "updated_at" = $2 WHERE "users"."id" = $3 [["last_login_at", "2019-12-19 02:39:57.101132"], ["updated_at", "2019-12-19 02:39:57.103303"], ["id", 3]]
appeals-app | [2019-12-19 02:39:57 +0000] (1.7ms) COMMIT
appeals-app | [2019-12-19
@enriquemanuel
enriquemanuel / tagging.sh
Last active October 7, 2019 17:44
Tagging AWS Resources via Bash
#!/bin/bash
# CloudWatch Logs
for log in `aws logs describe-log-groups | jq -r ".logGroups[].logGroupName" | grep appeals`; do
env=""
if echo "$log" | grep -q "dev"; then
env="dev"
elif echo "$log" | grep -q "prod"; then
env="prod"
else