Creating a website and deploying on AWS
In this blog, I will share my internship work that is how I deployed a website on AWS and see some websites that are using AWS and we also see how AWS is the best place to host a website.
Famous websites that use AWS
Netflix
Netflix is a streaming service that offers a wide variety of award-winning TV shows, movies, anime, documentaries, and more — on thousands of internet-connected devices. It is one of the largest OTT platforms, used by millions of people all over the globe. Netflix uses AWS for nearly all its computing and storage needs.
Netflix was the most prominent early user of AWS, adopting it in 2009. Netflix closed all of its data centers and moved “all-in” into the cloud by the mid of 2015. By 2016, the number of resources demanded by Netflix was more than what AWS was capable of, and this forced AWS to upgrade its infrastructure and develop to the level it is now.
Why AWS is the best place to host a website
Hosting a website or a web application has a lot of benefits compared to hosting it on a traditional on-premises data center.
- Easy to use
AWS is designed to allow application providers, Independent Software Vendors, and other vendors to quickly and securely host their applications or websites. The application may be an existing application or even a new SaaS-based application. We can use the AWS Management Console or well-documented web services API to access AWS’s application hosting platform
2. Flexible
AWS enables you to select the operating system, programming language, web application platform, database, and other services you need. With AWS, you receive a virtual environment that lets you load the software and services your application requires. This eases the migration process for existing applications while preserving options for building new solutions.
3. Cost-Effective
You pay only for the compute power, storage, and other resources you use, with no long-term contracts or up-front commitments. The AWS Economics Center provides information on the comparison of the costs between other hosting providers and AWS.
4. Reliable
Amazon has built a multi-billion dollar online business that has been honed for more than a decade. With AWS, we can take advantage of of a scalable, reliable, and secure global computing infrastructure, the virtual backbone of Amazon’s business.
5. Scalable and high-performance
Applications will sometimes be needed to be scaled up or down based on the incoming traffic and usage. Using AWS tools, Auto Scaling and Elastic Load Balancing, the application can be scaled up or down based on demand. Backed by Amazon’s massive infrastructure, you have access to compute and storage resources when you need them.
6. Secure
AWS utilizes an end-to-end approach to secure and harden our infrastructure, including physical, operational, and software measures. AWS uses a shared responsibility model where only the security of the application or website (security in the cloud) needs to be handled by us, and AWS handles the security of the cloud
Create a Website on AWS
I. Created website on EC2 using HTML and CSS
II. Used S3 to host the website
III. Used CloudFront distribution to access website.
— — — — — — — — — —
EC2:
- Launching EC2 instance
=> Choose Linux2 AMI
=> Pass this bootstrap script while creating instance
=>Configured Security group and edited inbound rules to open port for SSH and HTTP.
=>Choose keypair and download it
2. SSH into EC2 instance
3. Paste EC2 instance IP in browser to access the created website
S3:
choose to host the created website on S3.
- Go to the bucket that we created using bootstrap script.
- In the properties section, ENABLE static website hosting and choose to host a static website
- In the Permissions section, set the Block all public access to OFF.
- Make the index.html object public under Actions
- The object URL of the index.html can now be used to access the website.
CloudFront:
- Letting the clients/users access the object URL directly gives them the details of the region the bucket is in, the bucket name in which the object is stored.
- This might open unexpected doors for attackers.
- CloudFront solves this problem.
- Plus, CloudFront offers Global Edge Network and ensures that the content is securely delivered as it integrates with WAF, SSL Encryption, DDoS, etc.
- For Origin Domain, choose the bucket that has index.html from the dropdown menu.
- Use OAI and create new OAI
- Ensure to update the bucket policy
- Configure other details such as logging, default root objects, etc., according to the requirements. Since this is a static website, we could stick to the defaults.
- Once done, wait for the distribution to come live.
- Now copy the domain name from CloudFront’s distribution dashboard and paste it into the browser.
- We can access the website directly if index.html is specified as the default root object. Else, use copiedDomainName/index.html to access the website.
Here is the website that we created and hosted on AWS https://d16crgmkp340gr.cloudfront.net/
Network Diagram
Costing and Efficiency details
A. EC2 — instance can be deleted after copying the created website to S3.
B. S3: Since we are hosting a website, the objects will be accessed frequently and must be available at super-speed when needed. Hence, we are left with S3 Standard. But for the worst-case scenario, we can also consider S3 Intelligent tiering.
C. CloudFront:
Conclusion:
Hence, learned about how to deploy website on AWS
hope you find this blog useful
thank you for reading.