Skip to content

Instantly share code, notes, and snippets.

View mvanholsteijn's full-sized avatar

Mark van Holsteijn mvanholsteijn

View GitHub Profile
@mvanholsteijn
mvanholsteijn / update-all-route53-domains-contacts.py
Created February 10, 2020 14:48
update the contacts of all route53 registered domains
import boto3
import json
contact = {
"FirstName": "Mark",
"LastName": "van Holsteijn",
"ContactType": "COMPANY",
"AddressLine1": "Laapersveld 27",
"City": "Hilversum",
"CountryCode": "NL",
@mvanholsteijn
mvanholsteijn / generate-aws-directory-service-awsconfig-domain-create-ssm-document-command.sh
Created January 28, 2020 06:16
generates the SSM document required for automatic AD domain join on AWS
#!/bin/bash
aws ds describe-directories --query 'DirectoryDescriptions[*].{
"schemaVersion": `"1.0"`,
"description": join(``, [`Automatic AD domain-join configuration for `, Name, `.`]),
"runtimeConfig": {
"aws:domainJoin": {
"properties": {
"directoryId": DirectoryId,
"directoryName": Name,
"dnsIpAddresses": OwnerDirectoryDescription.DnsIpAddrs
AWSTemplateFormatVersion: '2010-09-09'
Description: AWS Backup daily CloudFormation configuration
Resources:
BackupPlan:
Type: AWS::Backup::BackupPlan
Properties:
BackupPlan:
BackupPlanName: default
BackupPlanRule:
- RuleName: daily-backups

Keybase proof

I hereby claim:

  • I am mvanholsteijn on github.
  • I am mvanholsteijn (https://keybase.io/mvanholsteijn) on keybase.
  • I have a public key ASC8m3WQn3rAaN6rL70h8G5tzhZXjiRrNBqS3heiR9KVego

To claim this, I am signing this object:

@mvanholsteijn
mvanholsteijn / gcp-instance-delete-external-ip
Created October 13, 2018 13:33
gcloud command deleting an external ip address from an GCP instance
#!/bin/bash
gcloud compute instances delete-access-config $INSTANCE --access-config-name external-nat
@mvanholsteijn
mvanholsteijn / copy route53 hosted zone
Last active March 29, 2021 12:08
a short shell script to copy the contents from one Route53 hosted zone to the other
#!/bin/bash
aws route53 list-resource-record-sets \
--hosted-zone ${SOURCE_HOSTED_ZONE_ID} \
--query '{Changes: ResourceRecordSets[?Type != `NS` && Type != `SOA`].{"Action": `UPSERT`, "ResourceRecordSet": @ }}' > changeset.json
aws route53 change-resource-record-sets \
--hosted-zone ${TARGET_HOSTED_ZONE_ID} \
--change-batch "$(<changeset.json)"
@mvanholsteijn
mvanholsteijn / copy-ssm-parameters
Created February 14, 2018 10:47
script to copy all SSM parameter store parameters to disk
#!/usr/bin/env python
#
# copy all SSM parameter store parameters to disk
#
import os, sys, argparse, boto3
parser = argparse.ArgumentParser(description='copy all parameter values to local')
parser.add_argument("--path", dest="path", required=True,
help="to copy the keys from", metavar="STRING")
parser.add_argument("--directory", dest="directory", required=True,
@mvanholsteijn
mvanholsteijn / report-cloudformation-stack-errors
Created February 8, 2018 12:57
Reports the failed resources in the last AWS CloudFormation stack operations.
#!/usr/bin/env python
#
# reports errors on the last stack operations
#
import sys
import boto3
def report_errors(stackname):
cfn = boto3.client('cloudformation')
@mvanholsteijn
mvanholsteijn / get-auth0-public-rsa-key-as-json
Last active December 18, 2017 13:49
Retrieve the public RSA key for the Auth0 tenant in PEM format as JSON String
AUTH0_DOMAIN=mvanholsteijn.eu.auth0.com
curl -sS https://$AUTH0_DOMAIN/pem | \
openssl x509 -pubkey -noout | \
tr -d '\r' | \
tr '\n' '|' | \
sed -e 's/|/\\n/g' | \
sed -e 's/^/"/' -e 's/$/"/'
@mvanholsteijn
mvanholsteijn / get-auth0-public-rsa-key
Created December 18, 2017 13:47
Retrieve the public RSA key for the Auth0 tenant in PEM format
AUTH0_DOMAIN=mvanholsteijn.eu.auth0.com
curl -sS https://$AUTH0_DOMAIN/pem | \
openssl x509 -pubkey -noout