Skip to content

Latest commit

 

History

History
64 lines (51 loc) · 4.04 KB

File metadata and controls

64 lines (51 loc) · 4.04 KB

AWS CLOUD FRONT

Managed service for CDN

  • CDN : Content Delivery Network

image

Without CDN

  • Ex: Instance --> User uploads --> Image --> Instagram will have a Central storage system (Australia)
  • Instagram copies the image that we have uploaded --> Now anybody in the world can access the image by using instagarm (Central stroage system)
  • A friend of the user --> trying to access the image --> In his instagram account

  • The user in india (Centeral storage system is in U.S) --> For this person in india to access the image
  • The request will go to muliple routers multiple Hawks to reach server and again it goes to multiple Hawks to reach the central storage system)
  • From storage system --> Goes to Instagram server --> To User
  • HAWKS -- MULTIPLE ROUTERS
  • (Available in US) --> The users in US can get the content very fast
  • The users in other countries like India they will have loading time Litency is high. UX is not good.

WITH CDN

  • User uploads an image (US) --> Goes to central storage system --> We will place a CDN here

  • People from other parts of world -- anyone trying to access this image -- Instead of accessing the instagram server directly

  • We will map the CDN to the instagram DNS and we will tell to access CDN

  • CDN is the service in AWS Cloud front --> Either access my CDN or we will map the domain name DNS with CDN

  • Whenever the person in india when they try to access the image they will directly talk to the CDN --> CDN WILL CREATES LOCAL COPIES OF THE IMAGE

  • Muliple copies of the image will be stored in the EDGE LOCATIONS (Copy in india region, US, and etc)

  • Now user ---> Instead of going to central region we can get the image from india region

  • When someone upload a reels or post in instagram --> intagram usese the CDN and it stores the image or reel in multiple local storage locations.

  • Instead of image stored in the Central location it will stored on EDGE LOCATIONS.

image

Create S3 bucket

  1. s3 bucket -->

  2. Block all access --> Should be enabled be'coz we are using direct access to S3 buckets itself to the USER

  3. image

  4. image

  5. Click on Bucket -> Properties --> Static Website hosting --> Enable it

  6. image

  7. Upload any static webpage index.html https://github.com/pavankumar0077/lightweight-gallery/blob/main/index.html

  8. Go to bucket properties --> In the last you will find URL --> When we try it will show 403 error --> Be'coz we blocked public access

  9. NOW WE HAVE TO USE CLOUD FRONT

  10. cloudfront --> image

  11. Click on create new OAI TO ACCESS THE S3

  12. image

  13. image

  14. image

  15. S3 bucket policy will be added

  16. image

  17. image

  18. image

  19. CREATE DISTRIBUTION

  20. If we copy and check distributed domain name

  21. image