AWS Classroomnotes 25/Aug/2023

AWS Storage contd

Problem

  • I have a web application running in multiple regions
    • us
    • uk
    • india
    • germany
  • This application uses images, videos from a s3 bucket in us region
  • us-web site is faster and i want the same response in other countries as well, so what are possible options
    Preview

Solution-1

  • One possible solution is to replicate content in one s3 bucket to other regions
    Preview
  • The videos, images and other content from us to other regions for faster access
    • Select the bucket => Management => Replication Rules
      Preview
      Preview
      Preview
      Preview
      Preview
      Preview
  • To Create role Watch classroom video

Solution – 2

  • Content Delivery Networks (CDN)
    Preview
  • AWS has lot of infra around the world and they offer CDN using a service called as Cloudfront
    Preview
  • So cloudfront can be used to solve this problem

Lab setup for CDN Solution

  • Ensure you have 4 videos of size atleast > 30 MB.
  • rename the files as one.mp4, two.mp4, three.mp4, four.mp4
  • Create an S3 bucket with ACL’s disabled and unblock all public access in oregon
  • upload the 4 videos to s3 bucket
  • Create a html page home.html with following content
<html>

<head>
    <style>
    @import url("https://fonts.googleapis.com/css?family=Raleway:400,400i,700,700i&display=swap");

body {
  padding: 2em;
  font-family: Raleway, sans-serif;
  font-size: 1.2em;
}

h1 {
  font-size: 3.6em;
  margin-bottom: 0.5em;
}
h2 {
  font-size: 2.4em;
  margin-bottom: 0.5em;
}

p {
  margin: 1em 0;
  line-height: 1.25;
}
</style>
</head>

<body>
    <h1>Video Sample Page</h1>

<p>This is the video we will work with. It uses a movie from the Blender Foundation (thanks :) )</p>
<div id="container">
  <video id='video' controls="controls" width="600">
    <source id='mp4' src="https://<your-bucket>.s3.us-west-2.amazonaws.com/one.mp4" type='video/mp4' />

  </video>
</div> <!-- End Container -->
<br/>
<div id="container">
  <video id='video' controls="controls" width="600">
    <source id='mp4' src="https://<your-bucket>.s3.us-west-2.amazonaws.com/two.mp4" type='video/mp4' />

  </video>
</div>
<br/>
<div id="container">
  <video id='video' controls="controls" width="600">
    <source id='mp4' src="https://<your-bucket>.s3.us-west-2.amazonaws.com/three.mp4" type='video/mp4' />

  </video>
</div>
<br/>
<div id="container">
  <video id='video' controls="controls" width="600">
    <source id='mp4' src="https://<your-bucket>.s3.us-west-2.amazonaws.com/two.mp4" type='video/mp4' />

  </video>
</div>

</body>
</html>
  • In the file replace <your-bucket> with your actual bucket name

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner