Created
August 3, 2021 04:30
-
-
Save brevityinmotion/e33febd7f027ae13b5540b23effc251e to your computer and use it in GitHub Desktop.
Lambda example to start a Glue crawler to index new data in preparation for analysis.
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
import json, boto3, os | |
def lambda_handler(event, context): | |
if event['program'] is None: | |
return {"isBase64Encoded":False,"statusCode":400,"body":json.dumps({"error":"Missing program name."})} | |
if event['operation'] is None: | |
return {"isBase64Encoded":False,"statusCode":400,"body":json.dumps({"error":"Missing operation name."})} | |
else: | |
operationName = str(event['operation']) | |
programName = str(event['program']) | |
client = boto3.client('glue') | |
response = client.start_crawler( | |
Name='brevity-httpx-recon' | |
) | |
responseData = { | |
'Program Status': 'Success', | |
'Operation Status': response | |
} | |
return { | |
'statusCode': 200, | |
'body': json.dumps(responseData) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment