Git Product home page Git Product logo

awslabs / aws-cloudfront-extensions Goto Github PK

View Code? Open in Web Editor NEW
161.0 17.0 58.0 89.94 MB

The CloudFront Extensions is a solution package as handy extension for using Amazon CloudFront.

Home Page: https://awslabs.github.io/aws-cloudfront-extensions/

License: Apache License 2.0

JavaScript 4.54% Python 46.88% Shell 1.62% TypeScript 34.67% CSS 0.76% HTML 7.99% Dockerfile 0.03% Java 0.48% SCSS 2.85% Velocity Template Language 0.19%
cloudfront cdk waf shield lambda lambdaatedge cloudfrontfunction

aws-cloudfront-extensions's Introduction

CFE logo
CloudFront Extensions

Amazon CloudFront operation toolkit

CloudFront Extensions GitHub project offers an open source package consisting of a set of applications and solution templates that covers various user scenarios for using Amazon CloudFront, Lambda@Edge and CloudFront Functions.

Feature

Monitoring

The solution provides two kinds of monitoring: non-real time monitoring and real time monitoring. You can choose one of them to deploy. You can use the solution to view CloudFront traffic metrics via built-in dashboard or via API calls. It analysis CloudFront logs to get the metric data and you only need to modify MetricsCollector, MetricsHelper and MetricsManager to add new metrics.

Config Snapshot

A Snapshot is a CloudFront Distribution configuration. By saving a complex CloudFront Distribution configuration to a Snapshot, the configuration (snapshot) can be reused to current or other CloudFront Distributions in your AWS account.

SSL Certificates

You can use this solution to automatically create or import SSL Certificates and associate them to new CloudFront distributions. The solution provides two kinds of jobs: Create Certificates Job and Import Certificate Job. You can use them on web console or via API calls.

Extensions Repository

The solution provides a set of ready-to-use extensions (Lambda@Edge functions, CloudFront functions, CloudFormation templates) that could be useful when you use CloudFront. You can deploy them from the solution web console. After deployment, you can directly use it without programming or customize it when needed.

Deployment

Time to deploy: Approximately 15 minutes.

Follow the step-by-step instructions in implementation guide to configure and deploy CloudFront Extensions into your account.

  1. Make sure you have signed in AWS Console.

  2. Click the following button to launch the CloudFormation Stack in your account.

    Region Launch Button
    Global Region Launch Stack

Architecture diagram

Deploying CloudFront Extensions solution with the default parameters builds the following environment in the AWS Cloud.

  1. Amazon CloudFront distributes the solution frontend web UI assets hosted in Amazon S3 bucket.
  2. Amazon Cognito user pool provides authentication for backend.
  3. Amazon AppSync provides the backend GraphQL APIs.
  4. Amazon API Gateway provides the backend RESTful APIs for SSL certificates and Monitoring features.
  5. Amazon DynamoDB stores the solution related information as backend database.
  6. Amazon Lambda interacts with other Amazon Services to process core logic of monitoring, SSL certificates and extensions repository, and obtains information updated in DynamoDB tables.
  7. AWS Step Functions orchestrate workflows for creating ACM certificates, importing existed certificates and creating CloudFront distributions.
  8. Extensions are shown in Extensions repository. AWS CloudFormation and AWS Serverless Application Repository will be triggered if you want to deploy an extension into your AWS account.
  9. AWS Lambda stores CloudFront configuration changes into S3 bucket, and you can view the difference between two CloudFront configuration versions and apply the configuration.
  10. Amazon Athena queries CloudFront standard logs or real-time logs to get CloudFront metrics and output it by API Gateway. You can also view the metrics by monitoring dashboard.

Contribution

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

aws-cloudfront-extensions's People

Contributors

alvindaiyan avatar arunsathiya avatar aws-cloudfront-extension-bot avatar cc4i avatar chenhaiyun avatar christofile avatar dependabot[bot] avatar guming3d avatar heqiqi avatar igkins avatar joe-wu-88 avatar neilkuan avatar ninglu avatar o0oooo avatar ricotoothless avatar rrxie avatar sussii avatar xavieru718 avatar yanbasic avatar zhouyuxiang-git avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws-cloudfront-extensions's Issues

Request doesn't hit same normalized query string cache

I deploy a normalize-query-string on edge in order to improve cache hit ratio as mentioned in this document.
However, it seems like that different query strings (e.g., key2=val2&key1=val1, KEY2=VAL2&KEY1=VAL1) which have been normalized in same order and lowercase (i.e., key1=val1&key2=val2) would not hit the cache.

I know there are four or more edge nodes, and request would pass to one of them as shown in Fig.1.

Fig.1
differentCDN

In this situation, I could not test hit ratio properly. Thus, I modify /etc/hosts on my laptop in order to lock specific edge node. The result is shown in Fig.2. Note that, these requests are finished in 3 seconds (within maxttl=10s)

Fig.2
lockCDN

Logs of hellocdk lambda
cloudwatch

Reproduction Steps

Deploy a cloudfront(with normalize-query-string ext) + apigateway + lambda
https://github.com/benkajaja/cdk-cloudfront-plus/tree/chore/Add-demo-of-normalize-query-string/src/demo/normalize-query-string

Modify cloudfront domain name(cfdomain) in demo.sh, and then execute it.

What did you expect to happen?

Within same edge node,
Task1: Miss
Task2: Hit
Task3: Hit
Task4: Hit

What actually happened?

Miss cache with same normalized query strings

Environment

  • CDK CLI Version : 1.89.0
  • Framework Version:
  • Language (Version):

Other

test

Reproduction Steps

What did you expect to happen?

What actually happened?

ffjdkfjd

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

role name of func ‘add-security-headers’ might exceed the limitation

Deploying the func ‘add-security-headers’ failed due to the length of role name exceed the limitation

1 validation error detected: Value 'realtime-fraud-detection-with-gnn-on-dgl-dashboardNestedStackdashboardNestedS-Resource-9H1DRR5KKLH4-edgeFunction' at 'roleName' failed to satisfy constraint: Member must have length less than or equal to 64 (Service: AmazonIdentityManagement; Status Code: 400; Error Code: ValidationError; Request ID: de66a180-a963-4c98-921b-52f03f110c83; Proxy: null)

Reproduction Steps

Deploy the func with long stack name(it’s generated by nested stack).

What did you expect to happen?

The func can be deployed successfully without error.

Per the doc of AWS::IAM::Role, the role is optional. pls let the CFN creating it for need.

What actually happened?

see above

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

serving-based-on-device function timeout issue

serving-based-on-device event type is viewer request, and function timeout should be 5 seconds, not 30 seconds. document

template
https://github.com/awslabs/aws-cloudfront-extensions/blob/main/edge/nodejs/serving-based-on-device/template.yaml#L13

Reproduction Steps

serving-based-on-device function associate to CloudFrontWebDistribution

What did you expect to happen?

deploy successfully

What actually happened?

get error

The function timeout is larger than the maximum allowed for functions that are triggered by a CloudFront event: 30 Max allowed: 5 Function: arn:aws:lambda:us-east-1:628531345753:function:demo-ServingDerv
iceBC28F36-ServingOnDeviceFunction-1LE1W6SEOWIM9:1 (Service: AmazonCloudFront; Status Code: 400; Error Code: InvalidLambdaFunctionAssociation; Request ID: 92639406-f1e6-44bc-a2c5-4955d7fc4618; Proxy: nul
l)

Environment

  • CDK CLI Version : 1.73.0
  • Framework Version:
  • Language (Version):

Other

t

Reproduction Steps

What did you

fsd

What actually happened?

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

how deploy cdk supported lambda@edge

❓ General Issue

The Question

I do see the deployment type of few Lambda@Edge functions are CDK in link. Then clicking the CDK link(for example, this one), it’s a project developed by SAM.

Pls guide how to use the functions with CDK!

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other information

Modify error response to 302 response

Modify error response to 302 response as per configuration.

Solution id: SO8115
Package name: cf-modify-error-response-to-302

Use Case

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Pre-warm cache from specified origin

Load objects from configuration list into specific PoP in order to accelerate access.

Solution id: SO8122
Package name: cf-pre-warm-cache-from-specified-origin

Use Case

The user is able to pre warm into the edge location to reduce the workload in the origin server

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

http302 function ARN get wrong value

I can't get the http302 function ARN

image

Reproduction Steps

cd edge/nodejs/http302-from-origin
sam deploy --guided --capabilities CAPABILITY_NAMED_IAM

What did you expect to happen?

get right http302 function ARN

What actually happened?

I get Http302Function value

Environment

  • CDK CLI Version : 1.21.1
  • **Framework Version: **
  • Language (Version): node v15.11.0

Other

I can fix this.

debug

dfdsf

Reproduction Steps

step 1
step 2

What did you expect to happen?

debug ex

What actually happened?

eye contact

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

source code url is out of date

Access origin by customized service

Access origin by geolocation, it will generate an HTTP redirect response with a country-specific URL and return the response to the viewer, for example, if the user is in US, it will return us.example.com, if the user is in CN, it will return cn.example.com

Need to use location service other than CloudFront-Viewer-Country to identify the geolocation

Solution id: SO8130
Package name: cf-access-origin-by-geolocation-by-custom-lib

Use Case

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Convert query string

Convert the query string to key & value pairs and add into header.

Solution id: SO8113
Package name: cf-convert-query-string

Use Case

Convert query string parameter to key/value pair and add it to the HTTP header.

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

test should be fail

Reproduction Steps

ff

What did you expect to happen?

What actually happened?

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

Access origin by geolocation

Access origin by geolocation, it will generate an HTTP redirect response with a country-specific URL and return the response to the viewer, for example, if the user is in US, it will return us.example.com, if the user is in CN, it will return cn.example.com

CloudFront-Viewer-Country can be used here to identify the geolocation

Solution id: SO8118
Package name: cf-access-origin-by-geolocation

Use Case

The user has some country-specific subdomains, such as us.example.com and tw.example.com, the user is able to generate a redirect response when a viewer requests example.com.

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

AWSLambdaFullAccess deprecated

The policy name AWSLambdaFullAccess is deprecated. We should use AWSLambda_FullAccess instead.

- arn:aws:iam::aws:policy/AWSLambdaFullAccess

see https://docs.aws.amazon.com/lambda/latest/dg/security_iam_troubleshoot.html#security_iam_troubleshoot-admin-deprecation

Reproduction Steps

What did you expect to happen?

What actually happened?

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

feature request

Use Case

fff

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

This is a test

This is a test

Reproduction Steps

step 1 This is a test
step 2 This is a test2

What did you expect to happen?

nothing,This is a test,This is a test,This is a test

What actually happened?

acutal ,This is a testThis is a testThis is a test

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

again

Reproduction Steps

step 1. abc
step 2. ded

What did you expect to happen?

opo pop

What actually happened?

funky music

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

Rewrite URL by USER-AGENT

Rewrite URL by USER-AGENT from HTTP header when a viewer requests the address.

Solution id: SO8111
Package name: cf-rewrite-url-by-user-agent

Use Case

The User-Agent request header is a characteristic string that lets servers and network peers identify the application, operating system, vendor, and/or version of the requesting user agent. By determining the User-Agent to rewrite request URL to different clients type like smartphone, tablet, desktop.

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue test

test

Reproduction Steps

What did you expect to happen?

What actually happened?

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

t2

Reproduction Steps

fdfs

What did you expect to happen?

dffdf

What actually happened?

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

drink

hello,

Reproduction Steps

good morning
step 1test
step2 test

What did you expect to happen?

nonthing

What actually happened?

nonthing at all

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

http302-from-origin return redirected and original content

Reproduction Steps

  1. Deploy http302-from-origin from SAR & binding with behavior
  2. Access url from the behavior

What did you expect to happen?

It's supposed to only return content from redirected url.

What actually happened?

It will show both content from origin & redirected url

Environment

  • Language (Version): Nodejs (12.x)

Other

tt

Reproduction Steps

What did you expect to happen?

What actually happened?

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

Validating token

Validate token from HTTP header by MD5 in order to prevent violent access.

Solution id: SO8121
Package name: cf-access-origin-by-md5-checksum

Use Case

Implement a mechanism to validate request token in HTTP header by MD5 Checksum.

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

hello

Reproduction Steps

Hello
step1.aa
step2. bbb

What did you expect to happen?

bottle

What actually happened?

waterfsdf
ffd

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

Rewrite URL by cookie

Rewrite URL by cookie information when a viewer requests the address.

Solution id: SO8109
Package name: cf-rewrite-url-by-cookie

Use Case

Read cookies in the viewer request and modifies the request URL accordingly.

Example: A/B Testing

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

test again

Reproduction Steps

tes
step1

What did you expect to happen?

expected

What actually happened?

actual

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

Format key & value

Format key & value pairs from POST request into specific form.

Solution id: SO8114
Package name: cf-format-key-value

Use Case

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Change picture format

Change picture format by libraries, for example, Pillow

Solution id: SO8127
Package name: cf-change-the-picture-format

Use Case

The user is able to use the function to change picture format, for example, change from PNG to JPEG

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

test

Reproduction Steps

Step 1.aaa
step2. bbb

What did you expect to happen?

not a funk

What actually happened?

funky chicken

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

Resize the picture

Resize images on the fly based on dimensions passed via query parameter

For example, after invoking https://{cloudfront-domain}/images/image.jpg?d=100x200, it will return a picture with size 100x200

Solution id: SO8123
Package name: resize-picture

Use Case

The user is able to invoke this function to resize image

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Authentication by native library

Integrate the native library, in this case using C library and include file, which's acting authentication function.

Solution id: SO8108
Package name: cf-authentication-by-native-library

Use Case

Support native libraries for authentication.

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

this is a test

Reproduction Steps

step 1. add
step 2.jfkdjfk

What did you expect to happen?

able

What actually happened?

not

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other

Generate static content

Return generated static content based on configured parameter

Solution id: SO8117
Package name: cf-generate-static-content

Use Case

The user is able to serve static website content, which reduces the load on the origin server and reduces overall latency. The user can generate HTTP responses for viewer request and origin request events

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Added more security headers to cover more scenarios

❓ General Issue

The Question

Added more security headers to cover more scenarios :

  • referrer-policy
  • enhanced 'content-security-policy'

Environment

  • CDK CLI Version :
  • Framework Version:
  • Language (Version):

Other information

OpenID token authentication example

Requires an example of OpenID Token authentication decoding example.

Use Case

Authentication again OIDC.

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Response status code 200 with zero sized body

The request from a specific domain name only responds with status code 200, but returns body=0

Solution id: SO8116
Package name: cf-modify-status-code-200-zero-body

Use Case

The user is able to use it as a heartbeat check, it will only return status code 200 but no response body

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Access origin by MD5 checksum

The same video file cannot be returned to the origin site multiple times, need to perform file MD5 verification when return to the origin site.

Solution id: SO8121
Package name: cf-access-origin-by-md5-checksum

Use Case

Proposed Solution

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Support Chinese in readme and workshop

Support Chinese in readme and workshop

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.