DEV Community

Cover image for Static website hosting on AWS
Maryanne
Maryanne

Posted on

Static website hosting on AWS

You might ask yourself why host my website on aws? AWS is the leading cloud provider in the market and offers a vast range of services and advantages like scalability,global reach, reliability,security,cost efficiency and a wealth of managed services making it ideal for all types of businesses.

Image description

Introduction:

In the ever-evolving realm of modern web development, the strategic utilization of cloud storage, content delivery, DNS management, and Continuous Integration/Continuous Deployment (CI/CD) has become instrumental. These services redefine the landscape by offering unparalleled benefits, transforming the way websites are built, deployed, and managed.

** The Importance of Cloud Storage:**
-Services like Amazon S3 revolutionize data management, providing developers with scalable and flexible storage solutions. This ensures agile infrastructure, accommodating vast amounts of data securely and facilitating reliable and accessible web applications.

-Seamless Global Access through Content Delivery:
Content delivery networks (CDN) like Amazon CloudFront are pivotal in meeting user expectations for instant access worldwide. By strategically distributing content across a global network, CDNs optimize performance, minimize latency, and deliver a seamless user experience.

-DNS Management: The Digital Address Book:
Amazon Route 53 exemplifies DNS and hosting management, translating human-readable domain names into machine-readable IP addresses. This ensures efficient routing, optimizing website response times and reliability for users navigating the digital landscape.

-Accelerating Development with CI/CD:
Continuous Integration/Continuous Deployment (CI/CD) tools, including AWS CodePipeline, CodeBuild, and CodeDeploy, streamline development lifecycles. Automation of testing, building, and deployment expedites processes, minimizes errors, and fosters efficient collaboration among development teams.

Leveraging Benefits: Scalability and Flexibility, Global Reach and Performance,Reliability and Redundancy, Agile Development and Deployment-CI/CD pipelines facilitate rapid and reliable deployment, empowering developers to innovate with efficiency.

In the competitive digital landscape, the synergy between modern web development and these services empowers developers to deliver applications with unprecedented efficiency and reliability, meeting the dynamic needs of users.

*How Can I Host My Website on AWS? *

1.You first need to sign up for an aws account . Aws Management Console (https://bit.ly/3U1f0jX)
Once you do login to the aws management console under services search for S3.

What is an s3 Bucket? It is an aws storage service where objects are stored. An object is a building block for storing and retrieving data. Learn more on s3 here AmazonS3 (https://bit.ly/3u4AHEX)

  1. Click on create bucket.
  2. Choose the aws region you would like your bucket to be hosted in . S3 buckets are regional.
  3. Click on general purpose - Allow a mix of storage classes that redundantly storage objects across multiple availability zones.
  4. Create a unique bucket name.
  5. For bucket ownership choose either ACLs enabled or disabled according to your preference.
  6. Under block public access settings for this bucket. Block Public Access is a set of settings and configurations in Amazon Simple Storage Service (Amazon S3) designed to help users prevent accidental exposure of their S3 data to the public. When you enable Block Public Access on a bucket or an account level, it enhances security by implementing restrictions on public access to S3 objects and buckets.
  7. Bucket Versioning means keeping multiple variants of an object in the same bucket meaning you can easily recover from unintended user actions and application failures.
  8. Configure encryption to your liking and click on create bucket

Image description

  1. Under general purpose buckets select your created bucket.
  2. You need to upload your objects (files) to your bucket
  3. Click on upload, then add files/ folder buttons or drag and drop your files .
  4. Click on upload.

Image description

2.Amazon Route 53 is a scalable DNS web service by AWS, managing domain names and providing domain registration. Serving as both DNS provider and registrar, it allows users to configure various DNS records.

With global reach, Route 53 enables traffic routing based on factors like location and latency. Integration with AWS services facilitates seamless association with resources. Supporting DNSSEC, it enhances security, while logging and monitoring features track DNS queries and health checks. Overall, Route 53 is crucial for reliable and secure DNS resolution, essential for web applications hosted on AWS.Kindly note that the service is paid for learn more about this here Amazon Route 53 pricing and billing (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Route53Pricing.html)

Alternatively you can host your website and acquire a domain name you need to purchase it from a providers like https://www.hostafrica.ke/ , namecheap http://bit.ly/48AS1QZ

You can also host and acquire a domain name free at https://firebase.google.com/ . Get the step by step here https://bit.ly/48P7Gfo

  1. Amazon CloudFront is a content delivery network (CDN) service by AWS. It accelerates the delivery of static and dynamic content, like images and videos, by distributing it globally across a network of edge locations. With low-latency access and high data transfer speeds, CloudFront enhances the performance and reliability of web applications, reducing load times for users worldwide. Awscloudfront (https://aws.amazon.com/cloudfront/)

-To create a distribution navigate to cloudfront (https://bit.ly/3O6Fixn) distribution Origin domain should be prefiled from your s3 object select it
-Origin path enter the url path for your domain name for origin requests
-Enter the name for this origin
-Default cache behavior has been pre-selected for you.
-values to specify when creating or updating a distribution (https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html)
-Then click on create distribution
-After CloudFront creates your distribution, the value of the Status column for your distribution will change from In Progress to Deployed. If you choose to enable the distribution, it will be ready to process requests after the status switches to Deployed.
-The domain name that CloudFront assigns to your distribution appears in the list of distributions. (It also appears on the General tab for a selected distribution.)
-When your distribution is deployed, confirm that you can access your content using your new CloudFront URL or CNAME.
For more information, see Testing a distribution.

Top comments (0)