Wednesday, April 3, 2019

DE_Assigment_Build a Serverless Web Application

This is the Data Engineering Assignment for my academic.
So that first I just going to implement a Web Application on Amazon which is serverless. For we have to pass from many steps such as 
1) Host a Static website
2)Manage Users
3)Build a serverless Backend
4)Deploy a RestfulAPI
5)Terminate Resources.

Now moving ahead step by step:
1) Host a Static website:-In this module we will configure Amazon Simple Storage Servies(s3) to host the static resources for your web application.



This architecture of this module is very straightforward. All of our static web content including HTML, CSS, JavaScript, Images and other files will be stored in Amazon S3. our End users will then access our site using the public website URL exposed by amazon s3. we don't need to run any web servers or use other services in order to make our site available.

Implementation Instructions:
Step1: Select a Region:

The web application can be deployed in any AWS region that supports all the services used in this application, which include Amazon Cognito. Aws Lambda, Amazo API gateway, Amazon s3 and amazon DynamoDB. we can refer to the region table to see which regions have supported services, among the supported regions we can choose are:
US East(N.Virginia)
US East(Ohio)
US west(Oregon)
EU(Frankfurt)
EU(Ireland)
EU(London)
Asia Pacific(Tokyo)
Asia Pacific(Seoul)
Asia Pacific(Sydney)
Asia Pacific(Mumbai)
Select our region from the dropdown in the upper right corner of the AWS Management console. I have selected Asia Pacific(Mumbai).


Step2: Create S3 Bucket:

Amazon s3 can be used to host a static website without having to configure or manage any web servers. In this step, we will create a new s3 bucket that will be used to host all of the static assets for our web application. 
  1. in the Aws Management console choose services then select s3 under storage.
  2. choose+create bucket
  3. provide a globally unique name for our bucket such as ranjande. If we get an error that our bucket name already exists, try additional numbers or characters until we find an unused name.
  4. select the region we have chosen to use for this workshop from the dropdown.
  5. Choose to create in the lower left of the dialogue without selecting a bucket to copy setting from





I have just used the bucket ranjande this time and in the above picture, it is in the 2nd row.

Step3: Upload content:

In this step, we will upload the website assets for this module to our s3 bucket. we can use the AWS Management console (requires to google chrome browser), AWS CLI, or the provided Cloud Formation template to complete this step.

Console step by step instruction:
In order to uploads all files and subdirectories in a local directory via the AWS Management Console, we must use the latest version of the Chrome web browser. 
  1. I have Downloaded an archive of the repository.
  2. Unzip this archive the downloaded content on our local machine.
  3. Open the AWS management console in chrome. Choose Services then select s3 under storage.
  4. Select the bucket you created in the previous step and ensure we are viewing the objects tab.
  5. open either windows file explorer or mac os finder and browse to the expanded contents of the zip file we downloaded in this first step.
  6. Browse to the web application from our local machine.
  7. Select all of the files and subdirectories under the website directory, ensure that the web directory itself is not selected.
  8. Drag and drop the selected files local file system to the content under the objects tab in the s3 console.
  9. Choose upload in this lower left of the dialogue box that appears.
  10. Wait for the upload to complete and ensure to see the contents of the website directory listed in the s3 console.
Step4: Add a Bucket Policy to Allow Reads:
For this we have to define who can access the content in our s3 buckets using a bucket policy, Bucket policies are JSON document that specifies what principals are allowed to execute various actions against the objects in our bucket.

In this step, we will add a bucket policy to our new Amazon s3 bucket to let anonymous users view our site. By default, our bucket will only be accessible by authenticated users with access to our AWS account.
  • In this  s3 console, select the name of the bucket we created in section1.
  • Choose the permissions tab, then choose the bucket policy.

{
   "version": "2012-10-17",
          "Statement": [
                   {
                       "Effect": "Allow",
                        "Principal":"*",
                        "Action": "s3:GetObject",
                        "Resource":"arn:aws:s3:::[ranjande]/*"
                   }
                             ]
}


  • Choose to save to apply the new policy.

Step5: Enable website Hosting:

  1. From the bucket detail page in the s3 console, choose the properties tab.
  2. Choose the static website hosting card.
  3. select use this bucket to host a website and enter index HTML for the index document. Leave the other fields blank.
  4. Note the Endpoint URL at the top of the dialogue choosing save, we will use URL throughout the rest of the workshop to view our web application.
  5. Click save to save changes. 

Step6:  Validate our Implementation:
After completing these implementation steps we should be able to access our static website end URL for our S3bucket.
Visit our websites' base URL in the browser of our choice. we should see wild Rydes home page displayed.



wildrydes-homepage


Thanks for reading the complete blog.




2 comments:

  1. I’m impressed, I have to admit. Truly rarely should i encounter a blog that’s both educative and entertaining, and let me tell you, you’ve got hit the nail to the head. Your thought is outstanding; ab muscles a thing that too little people are speaking intelligently about. We are very happy that I came across this at my try to find some thing about it. best of the web directory

    ReplyDelete