Search code examples
amazon-web-servicescloudamazon-elastic-beanstalkamazon-cloudfront

How to design AWS architecture for my new course selling website?


I am designing an AWS architecture for hosting a website that sells online courses and merchandise products. For the purpose, I am planning to use the following architecture design:

  • 1 VPC
    • 1 Application (RDS database + PHP web application)
      • Under Application, there can be 1 EC2 instance, 1 RDS database
      • S3 bucket
        • To store all static files, images, stylesheets, javascript files etc.
        • To upload all dynamic files, images, etc. (to be uploaded by users & website admin)
        • A CDN domain (e.g. cdn.mydomain.com) will be created to serve all files from S3 bucket.
    • 1 CloudFront (for content hosting & delivery)
    • AWS Router 53 (for domain & subdomain)

As per my knowledge and understanding, CloudFront should be used to deliver the content from S3 bucket that's why I am thinking of this.

Question #1: Should I create a VPC and encapsulate all AWS services/resources under it like S3, Application, RDS Database?

Question #2: Should CloudFront be used for the purpose?

Question #3: Is there any better approach for achieving this?

Note: Please note that I am trying to utilize the resources under Free Tier as much as possible to avoid cost as this is an initial phase of the website and I will be selling my courses through this as of now. And, there will be videos for each session/lecture where each video can be of 2GB or more in size and for 1 course there can be 40-50 videos that students can access only after making a purchase. Also, I would love to know if I should add anything that I missed.

Happy to hear experts' advise/suggestions on this.


Solution

  • Amazon CloudFront

    You mention that you wish to operate under the AWS Free Tier. However, serving video content from Amazon S3 or Amazon CloudFront could incur considerable cost.

    The Free Tier for Amazon CloudFront provides 1TB of data transfer charges. Depending upon where your users are located, CloudFront costs beyond 1TB would be $0.085 per GB for Data Transfer. Beyond the Free Tier, each 2GB video would therefore cost you around 18c in Data Transfer charges alone. If they watch 50 videos, this would be $9. I only mention this because the economics of serving videos might outweigh any other cost savings you make.

    CloudFront is good for delivering content faster to users around the world. Since you wish to provide paying users access to private content, you would use signed URLs to allow users to access the private videos via CloudFront. You can put CloudFront 'in front' of your EC2 instance and S3 bucket (using different sub-paths).

    VPC

    If you are using an Amazon EC2 instance that needs to communicate with an Amazon RDS database then, yes, you would want to create a VPC for those resources. Typically, the EC2 instance goes in a public subnet so that it is accessible from the Internet and the database would go in a private subnet so that it is accessible from the EC2 instance but is not otherwise reachable from the Internet.

    Please note that Amazon S3 does not go 'inside' a VPC. It is a web service directly accessible via the Internet, or via Amazon CloudFront.