This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const AWS = require("aws-sdk") | |
const _ = require("lodash") | |
const dynamo = new AWS.DynamoDB.DocumentClient({ | |
apiVersion: "2012-08-10", | |
region: "eu-west-1" | |
}) | |
const BATCH_SIZE = 25; | |
const sourceTable = "<put-value-here>"; | |
const destinationTable = "<put-value-here>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
START TRANSACTION; | |
INSERT INTO flights.routes (airportFrom, airportTo, connectingAirport, newRoute, seasonalRoute, operator, `group`, tags, similarArrivalAirportCodes, carrierCode) VALUES ('FOO', 'ROLLBACK_1', null, false, false, 'RYANAIR', 'CITY', '', '', 'FR'); | |
INSERT INTO flights.routes (airportFrom, airportTo, connectingAirport, newRoute, seasonalRoute, operator, `group`, tags, similarArrivalAirportCodes, carrierCode) VALUES ('FOO', 'ROLLBACK_2', null, false, false, 'RYANAIR', 'CITY', '', '', 'FR'); | |
INSERT INTO flights.routes (airportFrom, airportTo, connectingAirport, newRoute, seasonalRoute, operator, `group`, tags, similarArrivalAirportCodes, carrierCode) VALUES ('FOO', 'ROLLBACK_3', null, false, false, 'RYANAIR', 'CITY', '', '', 'FR'); | |
ROLLBACK; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TRIGGER IF EXISTS UPDATED_ROUTE; | |
CREATE TRIGGER UPDATED_ROUTE | |
AFTER UPDATE | |
ON routes | |
FOR EACH ROW | |
BEGIN | |
IF ( | |
MD5(CONCAT_WS('', NEW.airportFrom, NEW.airportTo, NEW.connectingAirport, NEW.newRoute, NEW.seasonalRoute, NEW.operator, NEW.group, NEW.tags)) | |
<> MD5(CONCAT_WS('', OLD.airportFrom, OLD.airportTo, OLD.connectingAirport, OLD.newRoute, OLD.seasonalRoute, OLD.operator, OLD.group, OLD.tags)) | |
) THEN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TRIGGER IF EXISTS DELETED_ROUTE; | |
CREATE TRIGGER DELETED_ROUTE | |
AFTER DELETE | |
ON routes | |
FOR EACH ROW | |
BEGIN | |
CALL mysql.lambda_async( | |
'arn:aws:lambda:eu-west-1:XXXXXXXXXX:function:RDS-EVENTS-CONSUMER', | |
JSON_OBJECT( | |
'old', JSON_OBJECT( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TRIGGER IF EXISTS NEW_ROUTE; | |
CREATE TRIGGER NEW_ROUTE | |
AFTER INSERT | |
ON routes | |
FOR EACH ROW | |
BEGIN | |
CALL mysql.lambda_async( | |
'arn:aws:lambda:eu-west-1:XXXXXXXXXX:function:RDS-EVENTS-CONSUMER', | |
JSON_OBJECT('new', JSON_OBJECT( | |
'airportFrom', NEW.airportFrom, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function aws-sso() { | |
aws configure sso --profile default | |
ACCESS_KEY_POSTFIX="\"$(aws configure list --profile default | grep access_key | awk '{print $2}' | sed 's/*//g')\"" | |
SECRET_KEY_POSTFIX="$(aws configure list --profile default | grep secret_key | awk '{print $2}' | sed 's/*//g')" | |
ACCESS_KEY_FILTER=". | select(.Credentials.AccessKeyId | endswith($ACCESS_KEY_POSTFIX))" | |
SECRET_KEY_FILTER=". | select(.Credentials.SecretAccessKey | endswith(\"$SECRET_KEY_POSTFIX\"))" | |
for entry in ~/.aws/cli/cache/* | |
do | |
FOUND_ACCESS_KEY="$(cat $entry | jq -r "$ACCESS_KEY_FILTER")" | |
FOUND_ACCESS_SECRET="$(cat $entry | jq -r "$SECRET_KEY_FILTER")" |
NewerOlder