DEV Community

Cover image for Amplify your web development speed with "AWS Amplify"
Tanushree Aggarwal
Tanushree Aggarwal

Posted on

Amplify your web development speed with "AWS Amplify"

Introduction:

We live in the age of THE WEB. Knowing how to host a website is essential in today’s digital age. It empowers individuals and businesses to establish their online presence, share their ideas, and reach broader audiences. It provides full control over how your website operates, looks, and functions, allowing customization to suit personal or professional needs. To many, this may still seem like a daunting task. Gone are the days when you needed to rely on third parties or host your own web servers to be able to publish a website. In this blog I will be demonstrating a way to host a website, just with a few simple clicks.

Services :

AWS Amplify:

AWS Amplify is everything you need to build web and mobile apps. Easy to start, easy to scale.
If I had to describe AWS Amplify in 3 words, I would say "hosting made simple".
Few reasons why you should make "AWS Amplify" your best friend:

  • deploying application frontends with simple Git based workflows
  • spinning up multiple environments by connecting branches from Git (or any other version control system)
  • support for numerous languages, ranging from Java to Typescript to React
  • built-in CI/CD, eliminating the need for manual code updates/deployment

Goal:

In this demo, we will be deploying a website using a single AWS service AWS Amplify, under five minutes and zero dollar spend! We will then modify the website code and see what kind of changes need to be performed to our deployment, in order to reflect the updated code.

Pre-requisites :

  1. AWS IAM account (do not use root account) having:
    • admin privileges
    • access to AWS Management Console
  2. A Github (or any other VCS like Bitbucket) account

Cost :

  • None (if you have an AWS free-tier eligible account). Check AWS Amplify pricing details here

Implementation:

Let's begin!

Before we begin with the AWS bit, let us get our website code ready.

This does not have to be a fancy website; our aim is to understand the integration, so we will be using a basic HTML file. You can of-course choose to go full Ninja if that is what you prefer!

  1. Login to your Github account and create a new repository.
  2. Create your website homepage index.html file. If you are not a HTML wizard (like me), do not panic! I have you covered here! Simply copy-paste the following code, and save it as index.html.

Note: It is mandatory that you name the main file as index.html.
AWS Amplify requires an index.html file primarily because it acts as the entry point for a web application.

Optionally save any jpeg image with the name welcome.jpg under the same path. (This is just for aesthetic, you can totally skip this step)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Hello World</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            text-align: center;
            margin: 0;
            padding: 0;
            background-color: #000000;
        }
        h1 {
            color: #db3f30;
        }
        h2 {
            color: #da3728;
        }
        img {
            width: 300px;
            height: auto;
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <h1>Welcome to my AWS Amplify demo website</h1>
    <img src="welcome.jpg" alt="Welcome Image">
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

We are now ready to host this static website using AWS Amplify.

  1. Login to the AWS Management Console as an IAM user, and switch to the region of your choice. In this demo I will be using eu-central-1, but you can choose one closer to your geographical location.

  2. From the Services hamburger menu navigate to AWS Amplify
    Image description
    This will take you to the Amplify homepage.
    Image description

  3. Click Deploy an App
    Image description

  4. Amplify supports integration with a number of Version Control Systems. Select your preferred tool, and click Next. I will be working with Github in this demo.
    Select Github and click Next
    Image description

  5. A pop-up appears on the screen. This may differ from the below screenshot, depending on which version control tool you chose at step-4. Verify your identify and authorize AWS Amplify to access your VCS system.
    Image description

  6. Next, you will be prompted to select the repositories you want AWS Amplify to be able to access.
    Click Only selected repositories and select the desired repository from the drop-down list.
    Image description

    Note: As per the security best practice Principle of least privilege, it is advisable to select specific repositories, and avoid selecting the All repositories option.
    Note: You may be prompted for a MFA code, if you have this security feature enabled for your Github account.
    Image description

  7. If you granted permissions to multiple repositories, select the relevant repo from the dropdown list at this stage. Additionally, select the repo branch which has the code for the website. To reiterate, the index.html needs to be at the repo landing path.
    Image description

  8. Give the application a name, and click Next
    Image description

  9. Review the details, and click Save and deploy
    Image description

  10. Now we wait! The deployment may take a few minutes to complete.
    Image description
    Image description

  11. Once the deployment is complete, and you see the deployed status on your screen, cross your fingers and click Visit deployed URL.
    Image description

  12. Tada! our website is deployed!
    Image description

Impressed?

Bonus

Hold on! Our demo does not end here!

In the real world, we seldom deploy the complete website in the first attempt. Often any code goes through multiple iterations, before the final version.

Suppose this is the case with our demo website as well. To publish the updated code, we do not need to repeat the whole process!
AWS Amplify is that one best friend, who notices even the slightest change in our mood and adapts accordingly!

Confused? Let me demonstrate!

Let us make some modifications to theindex.html in our github repo .

I have simply added a new h2 to the body section.

<body>
    <h1>Welcome to my AWS Amplify demo website</h1>
    <h2>Did you like my AWS Amplify demo?</h2>
    <p></p>
    <img src="welcome.jpg" alt="Welcome Image">
</body>
Enter fullscreen mode Exit fullscreen mode

As soon as I click commit in my Github repo, AWS Amplify detects the change, and starts a new deployment!

Image description

Open the deployment URL when the status changes to deployed. This may take a few minutes to complete.

Image description

Our updated code is reflecting on our website!

Image description

  • This did not require any manual intervention or redeployment!
  • The deployment URL remains unchanged after the update
  • AND there was ZERO downtime during the upgrade!

If you weren't impressed before, I am sure you are NOW!

So, are you going to AWS Amplify a try?

The capabilities of AWS Amplify do not end here. In fact, this was just the tip of the iceberg!
In an upcoming blog, I will be demonstrating how AWS Amplify can be integrated with other AWS services.

Till then, give AWS Amplify a try and come back for more such content.

Happy learning!

References:

  1. Getting Started with Amplify
  2. Development with AWS Amplify
  3. AWS Amplify FAQ
  4. Banner image and demo-website image are AI generated, using DALL-E

Top comments (4)

Collapse
 
gaz profile image
Gary Pyne

I'm building an app with VueJs and NodeJs - Can I host both front & backend using Amplify? Can they use the same Amplify insance?

Collapse
 
tanushree_aggarwal profile image
Tanushree Aggarwal

Yes, AWS Amplify allows you to host both the frontend and backend components of your application on the same platform. However, they are typically managed as separate parts of the project. While they are deployed together as part of the same Amplify project, the frontend and backend operate independently. Amplify makes it easy to integrate them through its seamless backend management tools.

Collapse
 
dsaga profile image
Dusan Petkovic

Very good one for reference, I've used it but never configured myself, do you know what is the quota for the free tier?

Thanks

Collapse
 
tanushree_aggarwal profile image
Tanushree Aggarwal

Hi Dusan, The free-tier quota limit is pretty great! Deployments free throughout the 12 month free-tier cycle, 1000 build minutes/month, 15GB egress, 500k requests/month just to list a few. For the complete details, refer the link under the "cost" section of this blog.