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
# busmon.py | |
# Monitor CloudWatch Logs for EventBridge traffic. | |
# | |
# This script assumes that there is a Lambda function snooping an EventBridge bus | |
# and logging the events to a CloudWatch Logs group. | |
# | |
# Your format will likely be different and will require slight adjustments to the parsing | |
# logic below. The default format assumed for this version is: | |
# timestamp and other stuff|field|field|field|SNOOPED detail-type: <eventName> jsonString | |
# That is 5 pipe-delimited fields, where the last field is the only field used. |
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
$ aws pinpoint get-apps | |
{ | |
"ApplicationsResponse": { | |
"Item": [ | |
{ | |
"tags": {}, | |
"Id": "APP_PROJECT_IDENTIFIER", | |
"Arn": "arn:aws:mobiletargeting:us-east-1:AWS_ACCOUNT_ID:apps/APP_PROJECT_IDENTIFIER", | |
"Name": "Example project name" | |
} |
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
class DecimalEncoder(json.JSONEncoder): | |
''' | |
An encoder for use with json.dumps when the dict contains Decimal type objects | |
such as are returned for DynamoDB number attributes. | |
Usage: json.dumps(someDict, cls=DecimalEncoder) | |
''' | |
def default(self, o): | |
if isinstance(o, decimal.Decimal): | |
return float(o) | |
return super(DecimalEncoder, self).default(o) |
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
{ | |
"aws:rep:deleting": { | |
"BOOL": false | |
}, | |
"aws:rep:updateregion": { | |
"S": "us-east-1" | |
}, | |
"aws:rep:updatetime": { | |
"N": "1554766902.780001" | |
} |
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
''' | |
Utility function that wraps other utilities to run a pipeline that dumps data from existing table to an S3 file, | |
clears the table, configures the global table group, reloads the table from the backup | |
''' | |
success = enableGlobalTables( | |
'sourceTable': 'mySourceTable', | |
'sourceRegion': 'us-east-1', | |
'partitionKey': 'myPartKey', | |
'sortKey': None, | |
'backupBucket': 'myScratchBucket', |