I am running a service that distributes videos on a membership system, but the number of members is large and the server may be down.
Currently, we are publishing to AWS EC2 instances through the network, so we are exploring whether it can be solved using AWS services.

Current status

Multiple clone sites are created and operated on one server.
The clone site also has a video site, and separate videos are managed by another application.

Solutions you can think of

I came up with the idea of ​​using Cloudfront to cache videos on a cache server.


When I looked at the event, I found out that there was a problem that accessing the member information page on the member site would cache from the previous user's CDN.
This service has member information for each clone site, so it cannot be used if there is a possibility of leakage.

I want to ask

I'm sorry for lack of study.
Although it may be said that it should not be used in the first place, please tell us about the following.

  • Is it possible to set cache for each directory?
    Since it is a clone site, the directory where the video is uploaded is decided.
    If a directory can be specified, it may be possible to target only the contents of that directory.
  • Is it the same server, but if you use subdomains, do you have to make settings for each subdomain?
  • Answer # 1

    It's surprisingly difficult.
    It looks like you need to control what should be cached in the CDN and what is not.
    For the time being, it is mentioned in this part.

    After that, using Lambda @ edge, when you access the edge server, do you add a process to check if it is authenticated?
    Arrange access to CloudFront with Lambda @ Edge

    None of them has been handled so finely by yourself, so it's about "maybe you can go".

  • Answer # 2

    This type of content may be difficult to answer unless you specifically describe how it is done.

    Distribution method and high-load part are unknown, but if you are concerned about using CDN and the load is high in the distribution part of video, use external storage like Amazon S3 to externalize the distribution. If so, the load on the EC2 side will be lower.