Skip to content

Instantly share code, notes, and snippets.

View tomwwright's full-sized avatar
🎯
Focusing

Tom Wright tomwwright

🎯
Focusing
View GitHub Profile
- hosts: localhost
vars:
aurora_cluster_name: mycoolauroracluster
aurora_cluster_engine: aurora-mysql
aurora_cluster_version: 5.7.12
aws_region: ap-southeast-2
tasks:
- name: look for an existing Aurora cluster using the AWS CLI
command: >
# describing a non-existent Aurora cluster results in an error
$ aws rds describe-db-clusters --db-cluster-identifier doesnotexist
An error occurred (DBClusterNotFoundFault) when calling the DescribeDBClusters operation: DBCluster doesnotexist not found.
# but using --filter to describe a non-existent Aurora cluster is ok
$ aws rds describe-db-clusters --filters Name=db-cluster-id,Values=doesnotexist
{
"DBClusters": []
}
@tomwwright
tomwwright / iam-read-build-numbers.json
Last active December 17, 2018 10:31
Medium : Build Numbers with AWS CodeBuild
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:GetParameter",
"ssm:GetParameters"
],
"Resource": "arn:aws:ssm:{region}:{account-id}:parameter/build-number/*"
@tomwwright
tomwwright / update-build-numbers.js
Created December 17, 2018 10:59
Medium : Build Numbers with AWS CodeBuild
const AWS = require('aws-sdk');
const ssm = new AWS.SSM();
exports.handler = async (event) => {
const parameterName = '/build-number/' + event['detail']['project-name'];
const getBuildNumberParams = {
Name: parameterName
@tomwwright
tomwwright / iam-update-build-numbers.json
Created December 17, 2018 11:03
Medium : Build Numbers with AWS CodeBuild
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ssm:GetParameter",
"ssm:GetParameters",
"ssm:PutParameter"
],
@tomwwright
tomwwright / deepracer.py
Created December 20, 2018 05:10
Medium : AWS DeepRacer
THROTTLE_PENALTY_FACTOR = 0.5
STEERING_PENALTY_FACTOR = 0.5
def reward_function(on_track, x, y, distance_from_center, car_orientation, progress, steps, throttle, steering, track_width, waypoints, closest_waypoint):
'''
@on_track (boolean) :: The vehicle is off-track if the front of the vehicle is outside of the white
lines
@x (float range: [0, 1]) :: Fraction of where the car is along the x-axis. 1 indicates
max 'x' value in the coordinate system.
@tomwwright
tomwwright / create-tags-change-set.sh
Created December 6, 2022 00:26
Script to create a change set against a stack and execute it if it is exclusively Tags in scope
#!/bin/bash
set -e
set -o pipefail
set -u
# depends on cfparams: https://github.com/cultureamp/cfparams
FARM=$1
CHANGE_SET_NAME="changeset-tags-$(date +%Y%m%d%H%M%S)-$(git rev-parse HEAD)"