aws-lambda-edge

CloudFront -> S3 for static or API Gateway with multiple dynamic backends in ECS

旧街凉风 提交于 2021-02-07 18:42:54
问题 I need to implement a reverse proxy/redirect service for site which will be hosted in AWS S3 (static JS assets) + CloudFront and multiple backends running as different tasks AWS ECS available at domain.com/api/session_number Redirect or reverse proxy service should analyze input parameter and redirect to corresponding backend. So far I've found ECS-nginx-proxy but it looks more like the tool for dev/stage environments. How such service can be implemented for production using AWS services like

How to fix 503 error with resize image lambda edge functions on cloudfront?

假装没事ソ 提交于 2021-01-02 08:08:33
问题 I am trying resize images with a cloudfront distribution accoring to article : https://aws.amazon.com/tr/blogs/networking-and-content-delivery/resizing-images-with-amazon-cloudfront-lambdaedge-aws-cdn-blog/ I created project folder with given Origin-Response and Viewer-Request functions on article and I downloaded dependencies, deployed the zip package with cloudformation template. IAM Role, s3 bucket, bucket policy, distribution with lambda@edge functions were created without any error and

How to fix 503 error with resize image lambda edge functions on cloudfront?

喜欢而已 提交于 2021-01-02 08:08:17
问题 I am trying resize images with a cloudfront distribution accoring to article : https://aws.amazon.com/tr/blogs/networking-and-content-delivery/resizing-images-with-amazon-cloudfront-lambdaedge-aws-cdn-blog/ I created project folder with given Origin-Response and Viewer-Request functions on article and I downloaded dependencies, deployed the zip package with cloudformation template. IAM Role, s3 bucket, bucket policy, distribution with lambda@edge functions were created without any error and

AWS Lambda@Edge Nodejs “Environment variables are not supported.”

五迷三道 提交于 2020-08-04 05:46:38
问题 Motivation for doing this approach in the first place comes from Amazon: https://aws.amazon.com/blogs/compute/resize-images-on-the-fly-with-amazon-s3-aws-lambda-and-amazon-api-gateway/ (before they added the 'update'...) In our AWS Lambda resize function it resizes the image and stores it the new image on S3. const s3_bucket = process.env.s3_bucket; S3.putObject({ Body: buffer, Bucket: s3_bucket, ContentType: contentType, CacheControl: 'max-age=31536000', Key: key, StorageClass: 'STANDARD' })

How to extract bearer token in using boto3 python 3.8 in cloudfront request and use it in another query

梦想的初衷 提交于 2020-06-16 21:54:51
问题 How can I extract the bearer token in incoming cloudfront request and use it in another get request. curl -X GET \ https://domain/api/files/7d0ab8ef-9061-4458--de79a2c9e436 \ -H 'Authorization: Bearer eTA' \ -H 'Cache-Control: no-cache' \ -H 'Postman-Token: token' use the bearer token as jwt in the following request in phython domain.com/service/api/files/7d0ab8ef-9061-4458--de79a2c9e436 which gives me the following response : https://domain/file-service/api/files/7d0ab8ef-9061-4458-b97a

How to extract bearer token in using boto3 python 3.8 in cloudfront request and use it in another query

混江龙づ霸主 提交于 2020-06-16 21:52:51
问题 How can I extract the bearer token in incoming cloudfront request and use it in another get request. curl -X GET \ https://domain/api/files/7d0ab8ef-9061-4458--de79a2c9e436 \ -H 'Authorization: Bearer eTA' \ -H 'Cache-Control: no-cache' \ -H 'Postman-Token: token' use the bearer token as jwt in the following request in phython domain.com/service/api/files/7d0ab8ef-9061-4458--de79a2c9e436 which gives me the following response : https://domain/file-service/api/files/7d0ab8ef-9061-4458-b97a

Lambda@Edge when triggered Dynamodb giving 503 Error

丶灬走出姿态 提交于 2020-01-25 09:17:08
问题 I am trying to invoke Lambda through cloudfront viewer request . Here is my Lambda code 'use strict'; const AWS = require("aws-sdk"); const docClient = new AWS.DynamoDB.DocumentClient(); exports.handler = (event, context, callback) => { /* Get request */ const request = event.Records[0].cf.request; const requestbody = Buffer.from(request.body.data, 'base64').toString(); const data = JSON.parse(requestbody); const Id = data.Name; console.log(Id); /* Generate body for response */ const body = '