AWS Cloud Compute: Creating, Connecting Instances, and Sample HTML Webpage.
In the previous blog post, I provided an overview of what AWS Cloud Computing is, what services were offered/provided, advantages of AWS and getting your account started. In this post, I will demonstrate how to get started with Cloud Compute (EC2), demonstrate how to create an EC2 instance, connect to it and deploy it!
Creating an EC2 Instance
We'll start off by creating an EC2 instance which is basically a virtual machine in the cloud. You must first sign in to AWS as demonstrated in the last blog post.
1. Once signed in head over to the search bar and type in "EC2" and click on the service
3. Select an Amazon Machine Image (AMI). For this demonstration, I will choose the default "Amazon Linux"
2. Click on "Launch Instance" button
4. Choose an instance type. For this demonstration I will leave it as the "t2.micro instance" which is the eligible for the AWS Free Tier
5. For Key pair I chose "Proceed without a key pair" for this is only for demonstration purposes. In Network Settings "Allow HTTP traffic from the internet". And you can now officially launch your instance. Feel free to make any changes when creating an application.
Connecting to the instance
Now that we have created an EC2 instance, we'll have to connect to it.
1. Head over to the EC2 dashboard, navigate to Instances. You should be able to see the EC2 instance you created.
2. Select your instance and click the "Connect" button
3. Once you're connected to your instance you will see a SSH similar like this
4. You will need to update to the latest version of Amazon Linux is available. To do so, you will need to run the command sudo dnf upgrade --releasever=2023.0.20230329. Then command Y to install.
5. Now we'll install Apache web server on your instance. You can do this by running the following commands: sudo yum update -y and sudo yum install -y httpd.php
6. After installation start the Apache web server using the following command: sudo systemctl start httpd.service. Afterwards, enable it by using the following command: sudo systemctl enable httpd.service. You have now connected to the instance.
Demonstrating by creating a simple HTML web page:
Now that we have created and connected the instance, we can now test it out by creating a simple HTML web page. Also since we have started and enabled Apache web server we can create it by using Amazon Linux SSH.
1. We'll first start off by changing the directory to the web server's document root directory. We can use the command: cd/var/www/html.
And from there we can create a new file called "index.html". To do so we can use the command: sudo nano index.html

2. Afterwards we'll be brought to an empty page. There you will write down your code like an HTML document. Just like this screenshot.

3. Once you have done so we can exit and save it by pressing CTRL + X It'll ask "Save modified buffer?", type "Y" to save then Enter to go back. Once completed head back to the EC2 Dashboard, head over to your instance and copy the Public IPv4 address and paste it on any web browser. Below would be what the page would look like

4. And you're all done! You've created a webpage hosted by AWS EC2. There are various AWS products that you can use to personalize the webpage but essentially this is what it'll look like.
Overall, my experience in doing this project/demonstration was great, I learned a lot and would definitely recommend using AWS products to host your webpages.
Comments
Post a Comment