i have lambda api and try to authentication with cognito. i have a login page after i take username and password should i forward data a post method and how can i forward the keys to my main api?
The reporting service (git repository) will have to trigger the backup lambda in case of successful execution of storing the data in . Trigger the restore lambda in case of unsuccessful execution. Acceptance Criteria Restore UDM from backup in case of failure Backup UDM after successful execution of reporting service batch execution can you provide me microservice code implementation.
Try code below : It should work !!! import json def lambda_handler(event, context): # Check if 'body' exists in the 'event' dictionary and is a valid JSON string if 'body' in event and isinstance(event['body'], str): try: # Parse the JSON data from the 'body' field body_data = json.loads(event['body']) # Check if 'country' exists in the parsed JSON if 'country' in body_data: country = body_data['country'] message = "I love my {}".format(country) return { 'statusCode': 200, 'body': json.dumps({'message': message}) } else: return { 'statusCode': 400, 'body': json.dumps({'error': 'Missing "country" in JSON data'}) } except json.JSONDecodeError: return { 'statusCode': 400, 'body': json.dumps({'error': 'Invalid JSON data in the request body'}) } else: return { 'statusCode': 400, 'body': json.dumps({'error': 'Missing or invalid "body" field in the event'}) }
Hello Abduallah Mustafa, you can refer these 2 videos , there how to handle files with API Gateway is explained -- Serverless File Uploader with AWS HTTP Gateway and S3 - Step by Step Tutorial ruclips.net/video/13SswprYsHQ/видео.html&feature=shares Downloading images form AWS S3 via Lambda and API Gateway ruclips.net/video/WK11Glkdqfg/видео.html&feature=shares Hope this will be helpful! Happy Learning
couldn't figure out what made a lambda handler a post vs get http endpoint until watching this video. absolute legend. thanks man!
Glad to hear the video is helpful to you @adamurbas9185! Happy Learning
Thank you brother, much appreciated , stuck on post request since two days. Thank you
You are welcome DevOpsTech! Happy Learning
Thank you for sharing your expertise and please keep up the fantastic work. This video is really helpful...
Thank you Parthesh Soni! Stay Tuned & Happy Learning
Superb understood lambda today .. Thanks 🙏🙏
Glad to hear that FREEDOM! Happy Learning
nice explaination of this video I done this practically it worked thanks
Glad to gear that Saptanil Chowdhury! Happy Learning
nice explanation sir
Thannk you aparna podili! Happy Learning
i have lambda api and try to authentication with cognito. i have a login page after i take username and password should i forward data a post method and how can i forward the keys to my main api?
Really very helpful for me so thank you so much 😊❤️
Glad to know the video was helpful to you nitay pan! Happy Learning :-)
Very helpful, thanks!
You're welcome!
excellent work and brilliant way of illustrating concepts
Thank You Simranjit ! Happy Learning :-)
The reporting service (git repository) will have to trigger the backup lambda in case of successful execution of storing the data in .
Trigger the restore lambda in case of unsuccessful execution.
Acceptance Criteria
Restore UDM from backup in case of failure
Backup UDM after successful execution of reporting service batch execution
can you provide me microservice code implementation.
return is not working for giving output in console... What could be wrong
Hello YOGEETA DEVGHARE, please check cloudwatch logs , it will give some idea ..
Try code below : It should work !!!
import json
def lambda_handler(event, context):
# Check if 'body' exists in the 'event' dictionary and is a valid JSON string
if 'body' in event and isinstance(event['body'], str):
try:
# Parse the JSON data from the 'body' field
body_data = json.loads(event['body'])
# Check if 'country' exists in the parsed JSON
if 'country' in body_data:
country = body_data['country']
message = "I love my {}".format(country)
return {
'statusCode': 200,
'body': json.dumps({'message': message})
}
else:
return {
'statusCode': 400,
'body': json.dumps({'error': 'Missing "country" in JSON data'})
}
except json.JSONDecodeError:
return {
'statusCode': 400,
'body': json.dumps({'error': 'Invalid JSON data in the request body'})
}
else:
return {
'statusCode': 400,
'body': json.dumps({'error': 'Missing or invalid "body" field in the event'})
}
thanks bro, it helps
Glad to know the video is helpful to you Sager King! Happy Learning :-)
Keep up the great work!
Thank You Daniel Otembo! Happy Learning :-)
Bro , thank you so much for making this concept clear
Glad it was helpful!
great explanation :)
Thank You sai vamsi! Happy Learning :-)
what about file?
Hello Abduallah Mustafa, you can refer these 2 videos , there how to handle files with API Gateway is explained --
Serverless File Uploader with AWS HTTP Gateway and S3 - Step by Step Tutorial
ruclips.net/video/13SswprYsHQ/видео.html&feature=shares
Downloading images form AWS S3 via Lambda and API Gateway
ruclips.net/video/WK11Glkdqfg/видео.html&feature=shares
Hope this will be helpful! Happy Learning
It works on postman, but not on frontend such as react. AWS is pathetic af