Is there any way I can rename request parameters at API gateway itself instead of changing cloud function code, like appVersion to app_version
In AWS api gateway I had used requestTemplates of x-amazon-apigateway-integration
Related
For the calendar, I want to create a sync URL like this:
webcal://example.com/sync
Can this is possible using AWS API Gateway OR AWS Lambda.
AWS API Gateway allow to add domain then we can use that domain to call API. But can we call through webcal protocol?
I have searched a lot but not found any solution about it.
I have a lambda function exposed via API gateway but when I try to request it using fetch it is saying that I am forbidden to access it. How do I allow my function to call another function via API gateway?
There can be multiple reasons for it.
Check whether your API gateway endpoint is open or not. While specifying trigger for lambda you must have selected one option for security. You can edit this in API gateway Method Execution tab under Authorization Settings, select Authorization : None and API key required: false
You might not have enabled CORS on your api and due to that your api is not available on cross regions.
Your api gateway is not having access to lambda function. You can do that by attaching IAM role to your API gateway API which can trigger your lambda function.
I am using API Gateway and want to automate the creation of my environment using Cloudformation.
I'm only missing one thing, the Use Proxy Integration option. I can't find a reference to it in the documentation.
Here's an image of what I am talking about:
Is this available in Cloudformation and if not, any ETA or plans to make it available?
Ok, I found the answer to my question:
The Type, in the Integration , must be set to HTTP_PROXY and not HTTP.
Method:
Type: 'AWS::ApiGateway::Method'
Properties:
Integration:
Type: HTTP_PROXY # can also be: AWS, AWS_PROXY, HTTP, HTTP_PROXY, MOCK
HTTP_PROXY is correct for HTTP Endpoint pass through. If you are looking for Lambda Pass Through Proxy, you have to use AWS_PROXY.
Adding some description on each type.
AWS : for integrating the API method request with an AWS service
action, including the Lambda function-invoking action. With the
Lambda function-invoking action, this is referred to as the Lambda
custom integration. With any other AWS service action, this is known
as AWS integration.
AWS_PROXY : for integrating the API method request with the Lambda
function-invoking action with the client request passed through
as-is. This integration is also referred to as the Lambda proxy
integration.
HTTP : for integrating the API method request with an HTTP endpoint,
including a private HTTP endpoint within a VPC. This integration is
also referred to as the HTTP custom integration.
HTTP_PROXY : for integrating the API method request with an HTTP
endpoint, including a private HTTP endpoint within a VPC, with the
client request passed through as-is. This is also referred to as the
HTTP proxy integration.
MOCK : for integrating the API method request with API Gateway as a
"loop-back" endpoint without invoking any backend.
I am trying to use AWS API Gateway to proxy requests to some REST endpoints I have running in docker containers. I set up my API Gateway method for integration type HTTP and checked 'Use HTTP Proxy integration', But this is not simply proxying my requests, it strippes out the path parameters, query string parameters and body, and makes me map them to something.
Am I missing something, I don't want API gateway transforming my request I just want it to proxy it back to my internal REST endpoints.
FYI I am using a swagger doc to generate the API Gateway structure (their UI is quite annoying)
I read about {proxy+} endpoints which sound like what I want, but how do I define swagger docs about a certain endpoint action, or have granular apikey and authorizors on my endpoints?
You can set authorization only for resources and methods
. For example, we have the following API structure:
/
/test
GET (1)
PUT
/test/new (2)
ANY
/example/{proxy+}
GET (3)
1) For method
site.com/test endpoint
in GET method if you try to use the same key in PUT method you cath error.
2) For resource
site.com/test/new endpoint
in all methods in /test/new, but if you try to GET on /test/new/new2 you cath the error.
3) For resource(with proxy)
site.com/example/{proxy+} endpoint
You can auth to any example/* path.
I have created self client certificate within API Gateway. I would like my lambda to validate before processing the request from API Gateway (Configure Backend to Authenticate API).
API Gateway allows us to copy the certificate to clipboard. Which we can save as var or file to be read within Nodejs Lambda function, authenticate and proceed further.
Do we have examples?
API Gateway is invoking your AWS Lambda function via the the Lambda Invoke method in the AWS API. Your Lambda function isn't a web server, so it isn't receiving a direct HTTPS request from API Gateway, so it isn't going to receive the HTTPS client certificate.
I would question the need for this anyway. Your API Gateway should be using an IAM role to invoke the Lambda function. That's the mechanism you would use to make sure only API Gateway has access to invoke your Lambda function. The client-certificate is for web servers running behind API Gateway that don't use IAM for authentication.