Skip to content

Commit

Permalink
fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
minniux committed Feb 19, 2020
1 parent c166852 commit 398c06a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions snapshot-replicator/functions/shipper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import botocore
import re
import os
import json

source_region = os.environ['SOURCE_REGION']
target_region = os.environ['TARGET_REGION']
Expand All @@ -11,12 +12,13 @@
print('Loading function')

def lambda_handler(event, context):
if("Manual snapshot created" in event['Records'][0]['Sns']['Message']):
message = event['Records'][0]['Sns']['Message']
if "Manual snapshot created" in message:
source = boto3.client('rds', region_name=source_region)
source_snap = event['Records'][0]['Sns']['Source']
source_snap = json.loads(message)['Source ID']
snapshot_details = source.describe_db_snapshots(DBSnapshotIdentifier=source_snap)['DBSnapshots'][0]
if snapshot_detailts['DBInstanceIdentifier'] in instances.split(','):
source_snap_arn = snapshot_detailts['DBSnapshotArn']
if snapshot_details['DBInstanceIdentifier'] in instances.split(','):
source_snap_arn = snapshot_details['DBSnapshotArn']
target_snap_id = (re.sub('rds:', '', source_snap))
target = boto3.client('rds', region_name=target_region)
print('Will Copy %s to %s' % (source_snap_arn, target_snap_id))
Expand Down

0 comments on commit 398c06a

Please sign in to comment.