1
votes

Starting out with AWS Lambda and API Gateway and have created a small function, exposed through API Gateway using API keys.

All good - I can see the the apiKey sent through. What I'd like to do is use that API key to load the information I have stored against it in API Gateway.

The idea being, I can create new API keys in API Gateway and put an email address in the description box. When the 3rd party calls my API using their key, I'd like the AWS Lambda to be able to get this email address from teh description field by loading the details stored against the API key and use AWS SES to send an email.

Is this possible?

2
Just spotted the Amazon API Gateway REST API which would appear to give me a ways to do what I want. Generating a bloody AWS signature appears to be a faff!Neil

2 Answers

0
votes

As you already noted in the comments, you can use the Amazon API Gateway REST API to get this information. Be aware that the Amazon API Gateway REST API is a control plane API for managing your APIs. As such, it is not designed to scale to the level of invoke requests against deployed APIs. The Amazon API Gateway REST API imposes fairly low rate limits and they cannot be increased. If you need to do this at scale, then you would be better off managing the information yourself in DynammoDB, RDS, or Aurora.

0
votes

You should be able to use AWS CLI to access the API key info from within your Lambda(the argument to be sent is the API Key-ID, not the key value itself): http://docs.aws.amazon.com/cli/latest/reference/apigateway/get-api-key.html

Depending on which methods you are using to invoke your API, you will have to figure out a way to find the API-Key-ID of your call to execute the CLI command with.