Reputation: 174
I am trying to use a Lambda Function with CloudWatch as trigger to simulate a cron job.
I am having problem with the Lambda Function.
Here is my function:
import requests
URL = 'www.somesite.com/SchedulerEmail'
def lambda_handler(event, context):
requests.get(URL)
The lambda function is called "SchedulerEmail"
When I created it I choose python as language and pasted the code on aws "edit code inline" tab.
Upvotes: 0
Views: 749
Reputation: 18290
Only builtin libraries are available in Lambda environment. requests
library is not available by default in Python. You have to create a deployment package that includes the requests
library along with your lambda code and upload the package as .zip file either to S3 or directly to the Lambda function.
Follow the instructions here on how to create a deployment package for lambda.
Upvotes: 2