Skip to content

Instantly share code, notes, and snippets.

View nmarchini's full-sized avatar
🏠
Working from home

Nick Marchini nmarchini

🏠
Working from home
View GitHub Profile
@nmarchini
nmarchini / measure_pod_start.sh
Last active October 26, 2023 19:24 — forked from viggin543/measure_pod_start.sh
a script that outputs start time of a scheduled pod and the time taken to become ready
#!/usr/bin/env bash
if [ $# -ne 1 ]; then
echo "Usage: $0 <namespace>"
exit 1
fi
namespace="$1"
# Get the list of pod names in the specified namespace
@nmarchini
nmarchini / aws_delete-default-vpc.sh
Created April 30, 2021 15:15 — forked from jokeru/aws_delete-default-vpc.sh
Script to delete all AWS default VPCs from all regions using AWS CLI
#!/usr/bin/env bash
if [ "$AWS_PROFILE" = "" ]; then
  echo "No AWS_PROFILE set"
  exit 1
fi
for region in $(aws ec2 describe-regions --region eu-west-1 | jq -r .Regions[].RegionName); do
@nmarchini
nmarchini / .pre-commit-config.yaml
Created April 7, 2021 13:22
WIP pre-commit for terraform testing
---
# yamllint disable rule:line-length
default_language_version:
python: python3.8
repos:
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
hooks:
- id: check-json
- id: check-merge-conflict
@nmarchini
nmarchini / testzonetransfer.sh
Created March 10, 2021 12:30
Test Domain Zone Transfer for all domains in a text file
### This script runs through a list of domains in a text file called domains.txt and checks if zone transfer is enabled or disabled
## One domain per line in the for mydomain.com
## you can replace 1.1.1.1 with the DNS server to use for the checks.
#!/bin/bash
cat domains.txt | while read domain
do
echo $domain " " & dig axfr 1.1.1.1 $domain
@nmarchini
nmarchini / gist:d7df1f9de41fb150fbaf99d602c0b8dd
Created February 3, 2021 10:32
AWS Account 671402871606
AWS Account 671402871606 is an AWS Account in EU-west-1 that is used by elasticsearch, when you create a custom domain the ES service adds your certificate to their loadbalancer. You need to remove the ES domain before you can delete the certificate.
@nmarchini
nmarchini / gist:60b0ea1e508b59f7fee8b596786a3f7b
Created January 15, 2021 16:29
null_resource for adding custom domain to AWS Elasticsearch with Terraform
resource "null_resource" "domain_custom_endpoint" {
triggers = {
associations = module.elasticsearch-cluster.domain_hostname
}
provisioner "local-exec" {
interpreter = ["/bin/bash", "-c"]
command = <<EOF
aws es update-elasticsearch-domain-config --domain-name ${local.domain-name} --domain-endpoint-options EnforceHTTPS=true,TLSSecurityPolicy=Policy-Min-TLS-1-0-2019-07,CustomEndpointEnabled=true,CustomEndpoint=${local.cust_domain_name}.,CustomEndpointCertificateArn=${local.cert_arn}
EOF
}
@nmarchini
nmarchini / gist:6c03f083176f4424817aa725b6c9ac3a
Last active November 15, 2023 20:28
AWS SSL Certificate issue --ca-bundle AWS_CA_BUNDLE
This gets around the issue seen below when trying to run AWS CLI commands. Some networking devices that intercept the traffic can act like a main in the middle so can cause this issue
$ aws s3 ls
SSL validation failed for https://s3.eu-west-1.amazonaws.com/ [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)
There are a few ways to fix this, AWS docs say you can add the line for ca_bundle to the ~/.aws/config file but this didn't work for me as it was being overridden by a global environment variable.
[default]
# Add trusted hosts to the pip configuration on a per user basis.
On Unix the default configuration file is: $HOME/.config/pip/pip.conf which respects the XDG_CONFIG_HOME environment variable.
On macOS the configuration file is $HOME/Library/Application Support/pip/pip.conf if directory $HOME/Library/Application Support/pip exists else $HOME/.config/pip/pip.conf.
On Windows the configuration file is %APPDATA%\pip\pip.ini.
- Create the pip.ini or pip.conf file as requred for your OS
- Copy the code below into the file and save
@nmarchini
nmarchini / gist:1a3dc1273d1bf0307dee7d2348d70c25
Created December 5, 2019 14:43
AWS ECS Error on Windows Server
If you get this error then check that the EC2 instance has the correct ECS IAM Role or the service will not start.
2019-12-04T21:18:27Z - [INFO]:Starting the AmazonECS service...
Start-Service : Failed to start service 'Amazon ECS (AmazonECS)'.
At C:\Program Files\WindowsPowerShell\Modules\ECSTools\ECSTools.psm1:650 char:5
+ Start-Service -Name $Script:ECSService
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
ServiceCommandException

Keybase proof

I hereby claim:

  • I am nmarchini on github.
  • I am nmarchini (https://keybase.io/nmarchini) on keybase.
  • I have a public key ASBrs-RBXT9YNjH1Ib-KrcfAluf9G12Lxo2snGVgvZlKwwo

To claim this, I am signing this object: