def copy_local()

in lambda/snapshots_tool_utils.py [0:0]


def copy_local(snapshot_identifier, snapshot_object):
    client = boto3.client('rds', region_name=_REGION)

    tags = [{
            'Key': 'CopiedBy',
            'Value': 'Snapshot Tool for Aurora'
            }]

    if snapshot_object['StorageEncrypted']:
        logger.info('Copying encrypted snapshot %s locally' %
                    snapshot_identifier)

        response = client.copy_db_cluster_snapshot(
            SourceDBClusterSnapshotIdentifier=snapshot_object['Arn'],
            TargetDBClusterSnapshotIdentifier=snapshot_identifier,
            KmsKeyId=_KMS_KEY_SOURCE_REGION,
            Tags=tags)

    else:
        logger.info('Copying snapshot %s locally' % snapshot_identifier)

        response = client.copy_db_cluster_snapshot(
            SourceDBClusterSnapshotIdentifier=snapshot_object['Arn'],
            TargetDBClusterSnapshotIdentifier=snapshot_identifier,
            Tags=tags)

    return response