aws-api-gateway

CDK split API Gateway stack into 2 small stacks

不问归期 提交于 2020-01-24 10:50:50
问题 I'm trying to create a CDK stack in order to create API Gateway. Everything working as excepted if I create the stack in "small pieces" (comment part of the resources), But when I'm trying to create the completed stack I'm getting this exception: Number of resources, 224, is greater than maximum allowed, 200 Therefore, I tried to split my big stack into 2 smaller stacks, One stack creates the resource and create half of the resources and the other one fill relevant data. My structure is like

CDK split API Gateway stack into 2 small stacks

两盒软妹~` 提交于 2020-01-24 10:50:08
问题 I'm trying to create a CDK stack in order to create API Gateway. Everything working as excepted if I create the stack in "small pieces" (comment part of the resources), But when I'm trying to create the completed stack I'm getting this exception: Number of resources, 224, is greater than maximum allowed, 200 Therefore, I tried to split my big stack into 2 smaller stacks, One stack creates the resource and create half of the resources and the other one fill relevant data. My structure is like

How to invalidate CloudFront cache of dynamic content when content is updated

喜夏-厌秋 提交于 2020-01-23 10:58:11
问题 I am developing Web APIs using AWS Lambda, API Gateway and CloudFront. CloudFront is currently used as reverse proxy to some endpoints of API Gateway, cache behaviors are disabled at all. There are several frequently-used APIs, of which contents are rarely-updated (e.g. once a week or once a month) , therefore are candidates for caching for faster response time. However, I am wondering how to invalidate such CloudFront cache of frequently-used-but-rarely-updated dynamic content when their

How to invalidate CloudFront cache of dynamic content when content is updated

泄露秘密 提交于 2020-01-23 10:56:09
问题 I am developing Web APIs using AWS Lambda, API Gateway and CloudFront. CloudFront is currently used as reverse proxy to some endpoints of API Gateway, cache behaviors are disabled at all. There are several frequently-used APIs, of which contents are rarely-updated (e.g. once a week or once a month) , therefore are candidates for caching for faster response time. However, I am wondering how to invalidate such CloudFront cache of frequently-used-but-rarely-updated dynamic content when their

Nodejs API call returning undefined to lambda function

做~自己de王妃 提交于 2020-01-23 08:36:44
问题 This is the aws lambda function which will invoke an api: 'use strict'; var request = require("request") exports.handler = function (event, context,callback) { let url = "https://3sawt0jvzf.execute-api.us-east-1.amazonaws.com/prod/test" request({ url: url, method: "POST", json: event, }, function (error, response, body) { if (!error && response.statusCode === 200) { callback(null, { "isBase64Encoded": true|false, "statusCode": "200", "headers": { "headerName": "headerValue"}, "body": body});

AWS API Gateway and Lambda to return image

倾然丶 夕夏残阳落幕 提交于 2020-01-23 04:42:11
问题 Say I have this HTML: <img src="http://example.com/pic"/> What I would like to do is have example.com/pic map to an AWS API Gateway endpoint. That endpoint would then call a lambda function. That lambda function would read a random image from an s3 bucket and return it. So my aim is to use a STANDARD HTML image tag and end up with an image from an s3 bucket but going via some decision code in the lambda to decide the image to return. I know you can use s3 to serve static content directly

Create methods under / using CF for API Gateway

我是研究僧i 提交于 2020-01-23 04:11:48
问题 How do I create methods under API Gateway's root / folder using CF? So for example I have a Gateway that looks like the following: / OPTIONS POST However when trying to do that with CF I get: Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end. So my PathPart is the offending line. ApiGate: Type: AWS::ApiGateway::Resource Properties: ParentId: !GetAtt - ApiGateApi - RootResourceId PathPart: '{/}' RestApiId: !Ref ApiGateApi I can change the PathPart to

Create methods under / using CF for API Gateway

↘锁芯ラ 提交于 2020-01-23 04:11:18
问题 How do I create methods under API Gateway's root / folder using CF? So for example I have a Gateway that looks like the following: / OPTIONS POST However when trying to do that with CF I get: Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end. So my PathPart is the offending line. ApiGate: Type: AWS::ApiGateway::Resource Properties: ParentId: !GetAtt - ApiGateApi - RootResourceId PathPart: '{/}' RestApiId: !Ref ApiGateApi I can change the PathPart to

How can I see AWS Gateway logs for external calls?

蹲街弑〆低调 提交于 2020-01-22 17:55:55
问题 I need to be able to see the logs for my calls on AWS API Gateway . When I perform the calls from within Gateway's Dashboard I can see them under the Logs section. How can I see them for external call (e.g.: calls made using curl )? I tried enabling CloudWatch but I can only see the metric, and not the actual log messages. 回答1: The most likely reason for not being able to see API Gateway logs in CloudWatch logs is that you haven't specified the ARN of an IAM role that enables API Gateway to

AWS API Gateway with Lambda proxy always produces base64 string response

做~自己de王妃 提交于 2020-01-22 12:28:47
问题 I'm using API Gateway Lambda proxy integration and trying to return a binary application/protobuf response. No matter what I do, the response body is always a base64 encoded string I have application/protobuf setup as a binary media types in APIG My client (javascript) is sending following headers in the POST : Accept: application/protobuf Content-Type: application/protobuf My lambda is responing with content-type: application/protobuf , and correctly setting the IsBase64Encoded Lambda