AWS Classroomnotes 26/Jun/2022

Scenario 2-Exercise:

  • Delete all the s3 buckets
  • Create a new s3 bucket
  • upload an object with size atleast 10 MB to the bucket
  • change the storage class from standard to infrequent-access
  • Remove the object
  • upload a new object with private access
  • download the new object with s3 cli
  • Create a new bucket and move the object into the new bucket
  • Solution:
aws s3 mb s3://qt26june
aws s3 cp .\Downloads\one.mp4 s3://qt26june/Videos/

# changing storage class
aws s3 mv --storage-class 'STANDARD_IA' ....
aws s3api put-object

# creating object with private access
aws s3 cp C:\Users\Dell\Downloads\two.mp3 s3://qt26june/Videos --acl private
aws s3api put-object --key 'Videos/three.mp4' --bucket qt26june --acl private --body C:\Users\Dell\Downloads\three.mp4

Static Website Hosting with S3

  • Since S3 serves files over https, this feature enables the s3 to be hosting a static website.
  • Static Website => Web site with html, css and javascript
  • Lets create a static website
  • Create a bucket with some domain name qtstaticweb.com
  • Now upload two html files
aws s3 cp 'C:\Users\Dell\Downloads\newindex.html' s3://qtstaticweb.com/index.html --acl public-read
aws s3 cp 'C:\Users\Dell\Downloads\newerror.html' s3://qtstaticweb.com/error.html --acl public-read
  • Index.html
<html>
    <head>
        <title> Static Website Hosting by S3 </title>
    </head>
    <body>
        <h1> Welcome to Static Hosting by S3, Created by qt <h1>
    </body>
</html>
  • Error.html
<html>
    <head>
        <title> Static Website Hosting by S3 </title>
    </head>
    <body>
        <h1> Welcome to Static Hosting by S3 <h1>
        <h2> There seems to be some error </h2>
    </body>
</html>
  • Now Navigate to Properties of S3 bucket -> Static Website Hosting => Edit
    Preview
    Preview
    Preview
  • The following is sample created with some css
    Preview
  • Lets add some videos to our website
  • And to view them we have modified the index.html
<!DOCTYPE html>
  <html>
    <head>
      <!--Import Google Icon Font-->
      <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
      <!--Import materialize.css-->
      <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">

      <!--Let browser know website is optimized for mobile-->
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
      <title> QT AWS Sample </title>
    </head>

    <body>

      <!--JavaScript at end of body for optimized loading-->
      <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
      <div>
        <video width="320" height="240" controls>
        <source src="Videos/one.mp4">
        </video>
      </div>

      <div>
        <video width="320" height="240" controls>
        <source src="Videos/two.mp4">
        </video>
      </div>
    </body>
  </html>

Preview

Leave a Reply

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

About continuous learner

devops & cloud enthusiastic learner