Logo

dev-resources.site

for different kinds of informations.

Power Up Your AWS Game: Create EC2 Instances, Install Apache, and Connect with PowerShell

Published at
1/14/2025
Categories
aws
devops
ec2
apache
Author
franciscojeg78
Categories
4 categories in total
aws
open
devops
open
ec2
open
apache
open
Author
14 person written this
franciscojeg78
open
Power Up Your AWS Game: Create EC2 Instances, Install Apache, and Connect with PowerShell

In the world of cloud computing, Amazon Web Services (AWS) stands out as a powerful platform for developers and businesses. One of the most fundamental services offered by AWS is Amazon EC2 (Elastic Compute Cloud), which allows you to create virtual servers in the cloud. This post will guide you through the process of creating an EC2 instance, installing the Apache web server, and connecting to it using PowerShell.

Step 1: Creating an EC2 Instance

1.Log in to AWS Management Console:

Go to the AWS Management Console and log in with your credentials.

2.Launch an EC2 Instance:

  • In the console, find and select EC2 under the "Compute" section.
  • Click on Launch Instance.
  • Choose an Amazon Machine Image (AMI). For this tutorial, select an Amazon Linux 2 AMI or Ubuntu Server AMI.
  • Select an instance type (e.g., t2.micro for free tier eligibility) and click Next: Configure Instance Details.

3.Configure Instance Details:

  • Configure settings as needed (default settings work for most users).
  • Click Next: Add Storage, then proceed through the next steps until you reach the Review and Launch section.

4.Launch the Instance:

  • Review your settings and click on Launch.
  • You will be prompted to select or create a key pair. If you don’t have one, create a new key pair, download it, and keep it safe. This key pair is essential for connecting to your instance.

Step 2: Installing Apache Web Server

1.Connect to Your EC2 Instance:

  • Open PowerShell on your local machine.
  • Use the following command to connect via SSH (replace with your key file path and or with the appropriate username based on your AMI):
ssh -i "<path-to-key>.pem" ec2-user@<public-ip-address>

Enter fullscreen mode Exit fullscreen mode

2.Update Package Repository:

Once connected, update your package repository:

sudo yum update -y  # For Amazon Linux
sudo apt update     # For Ubuntu

Enter fullscreen mode Exit fullscreen mode

3.Install Apache:

Install Apache using the following command:

sudo yum install httpd -y  # For Amazon Linux
sudo apt install apache2 -y # For Ubuntu

Enter fullscreen mode Exit fullscreen mode

4.Start Apache Service:

Start the Apache service and enable it to run on boot:

sudo systemctl start httpd    # For Amazon Linux
sudo systemctl start apache2   # For Ubuntu

sudo systemctl enable httpd    # For Amazon Linux
sudo systemctl enable apache2   # For Ubuntu

Enter fullscreen mode Exit fullscreen mode

5.Adjust Firewall Settings:

  • Ensure that HTTP traffic is allowed through your instance's security group settings in the AWS console.
  • You may need to add a rule that allows inbound traffic on port 80 (HTTP).

Step 3: Verify Apache Installation

1.Access Your Web Server:

  • Open a web browser and enter your EC2 instance's public IP address.
  • If everything is set up correctly, you should see the default Apache test page.

Conclusion

Congratulations! You have successfully created an EC2 instance, installed the Apache web server, and connected using PowerShell. This setup serves as a foundation for hosting web applications on AWS.

Feel free to share your experiences or ask questions in the comments below!

aws Article's
30 articles in total
Favicon
Best Tips to Prepare for the AWS Certification Exam in 2025
Favicon
Building a Serverless REST API with AWS Lambda and API Gateway
Favicon
From Challenge to Creation: Building a Blog Post Generator with AWS and React
Favicon
AWS Certification Syllabus [Updated 2025]
Favicon
Simple SQL Generator using AWS Bedrock
Favicon
Amazon S3 vs. Glacier: Data Archival Explained
Favicon
Serverless NBA Data Lake Application with API Gateway, AWS Lambda, Amazon S3, AWS Glue and Athena Using Terraform
Favicon
Detect Inappropriate Content with AWS Rekognition
Favicon
Why AWS Matters: A Beginner's View
Favicon
Stop Worrying About EC2 Patching – Automate It Like a Pro!
Favicon
Step 1: GET-> SET-> AWS!
Favicon
My AWS Learning Journey Begins
Favicon
Something You Didn't Know About AWS Availability Zones
Favicon
3..2..1… AWS aterriza en MΓ©xico πŸš€ πŸ‡²πŸ‡½
Favicon
πŸ›‘οΈ Security Measures: Safeguarding Your Codebase πŸ”’
Favicon
What is Cloud Service Providers? Types, Benefits, & Examples
Favicon
Power Up Your AWS Game: Create EC2 Instances, Install Apache, and Connect with PowerShell
Favicon
Navigating Disaster Recovery in the Digital Age: Choosing the Right Approach – Part 3
Favicon
Choosing Between Amazon Bedrock and Amazon SageMaker AI: A Comprehensive Guide
Favicon
Navigating Generative AI Services on AWS: Your Essential Guide
Favicon
Top 10 Reasons to Learn AWS in 2025
Favicon
πŸš€ Week 3 Recap: Learning in Public – Software Engineering with DevOps πŸš€
Favicon
VPN Peering "Region to Region "
Favicon
Introducing vulne-soldier: A Modern AWS EC2 Vulnerability Remediation Tool
Favicon
Top 7 Kubernetes Certifications in 2025
Favicon
🚨 (Amazon) Interview Alert: I Just Decoded a Tricky JavaScript Question in 2 Minutes!
Favicon
How to Pay AWS Bills in Naira: A Quick Guide
Favicon
Building a Weather Data Collection System with AWS S3 and OpenWeather API
Favicon
Cloud computing can be confusing, but it doesn't have to be! β˜οΈπŸ€” In the latest episode of Cloud in List of Threes (CiLoTs), I’m serving up easy-to-digest (pun intended 🀭) explanations analogy to explain Regions, Availability Zones, and Edge Locations
Favicon
From Regions to Edge Locations: A CiLoTs Guide to Cloud Infrastructure

Featured ones: