This project contains a lambda function that is used to query the NASA api for earth images. An example endpoint can be access via the link https://itzwj9h4pe.execute-api.us-east-1.amazonaws.com/default/lambda_test.
The endpoint will return json in the following format:
{
"earth_engine_url":"image_url"
}
- Log into your aws console.
- Open the lambda service, by either selecting the link under the Compute header or typing the word lambda into the search bar.
- On the lambda page click on the Create function button in the top right hand corner.
- On the function setup page.
- Give the function a name i.e lambda_test.
- Runtime should be nodejs 8.10.
- Select create a new role and give the role an appropriate name like lambda_test.
- In order to create the role, select a policy to use as the template. In the example we use Simple microservice permissions which gives our new function access to the cloudwatch logs. N.B dynamoDB read / write access is also added, although not needed in our case.
- Finish the creation by selecting the Create function button.
- On the function page add an api gateway trigger from the Add triggers menu on the left of the page.
When creating a function for production use it is advised to pre-create the role for the function in IAM first, so that the permissions can be taylored to fit the functions requirements.