AWS S3 Contd…
Static Website Hosting
- S3 uses https and it allows to host a static website
- Static website allows
- html
- css
- javascript
- Lets create a simple webpage
- index.html (home page)
- error.html (error page)
- Create a bucket with acl’s enabled and grant public-read only

- Navigate to Properties => Static Website Hosting




- We have added some bootstrap content
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body>
<div class="jumbotron text-center">
<h1>My First Website</h1>
<p>Resize this responsive page to see the effect!</p>
</div>
<div class="container">
<div class="row">
<div class="col-sm-4">
<h3>AWS</h3>
<p>Lorem ipsum dolor..</p>
</div>
<div class="col-sm-4">
<h3>DevOps</h3>
<p>Lorem ipsum dolor..</p>
</div>
<div class="col-sm-4">
<h3>Azure</h3>
<p>Lorem ipsum dolor..</p>
</div>
</div>
</div>
</body>

* Added basic javascript
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Basic Modal Example</h2>
<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
CDN (Content Delivery Networks)
- Lets create an s3 bucket with video files and open them in some web page
- AWS has edge locations across the world Refer Here
- To enable CDN, AWS has a service called as cloud front.
- Lets create a distribution



- Replace the s3 access links for videos to cloudfront names
<head></head>
<body>
<div>
<video width="320" height="240" controls>
<source src="https://d2wax5ovdqyzkb.cloudfront.net/one.mp4" type="video/mp4" />
</video>
<video width="320" height="240" controls>
<source src="https://d2wax5ovdqyzkb.cloudfront.net/two.mp4" type="video/mp4" />
</video>
</div>
<div>
<video width="320" height="240" controls>
<source src="https://d2wax5ovdqyzkb.cloudfront.net/three.mp4" type="video/mp4" />
</video>
<video width="320" height="240" controls>
<source src="https://d2wax5ovdqyzkb.cloudfront.net/four.mp4" type="video/mp4" />
</video>
</div>
</body>
