gfabrizi / lambda-inception-sam

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lambda Inception Architectural Pattern (SAM version)

Post on dev.to: https://dev.to/gfabrizi/porting-lambda-functions-to-aws-sam-3hl7

Original link to dev.to post for explaination on the js code: https://dev.to/gfabrizi/lambda-inception-architectural-pattern-f67

Instructions:

Now that all the resources are deployed, you need to add api credential to the IAM user generated by SAM.
To do so go on IAM web console e click on the new lambda-inception-invoker user. Click on the "security-credentials" and next on "Create access key".
In the "Access key best practices & alternatives" select "Other" and click "Next". Give a descriptive tag to this api key (optional) and click on "Create access key".
In the last screen of the wizard, click on "Download .csv file" to save the credentials.

Now you can call your api endpoint like this:

curl -X POST https://YOUR_LAMBDA_FUNCTION_ENDPOINT/crawl -H 'Content-Type: application/json' \
-d '{"url":"https://example.org/"}' \
--user "ACCESS_KEY:SECRET_ACCESS_KEY" \
--aws-sigv4 "aws:amz:YOUR_AWS_REGION:lambda"

(modify YOUR_LAMBDA_FUNCTION_ENDPOINT, ACCESS_KEY, SECRET_ACCESS_KEY and YOUR_AWS_REGION with your config)

About


Languages

Language:JavaScript 100.0%