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!

apache Article's
30 articles in total
Favicon
Power Up Your AWS Game: Create EC2 Instances, Install Apache, and Connect with PowerShell
Favicon
AutoMQ: A Revolutionary Cloud-First Alternative to Kafka
Favicon
Laravel 11: Allowed memory size of 134217728 bytes exhausted (tried to allocate 23085056 bytes)
Favicon
Seamlessly Migrate PostgreSQL to YugabyteDB in Minutes!
Favicon
Apache Log Parser and Data Normalization Application
Favicon
Unlock 10% Discounts in 5 Minutes: Build a Drools Project with Maven
Favicon
[pt-BR] Como criei minha prรณpria imagem Docker do Apache Benchmark para testes de stress em servidores web
Favicon
What Goes Into a Major OSS Release? A CouchDB Story
Favicon
Monitor Apache Ignite in 5 Minutes: Fix Cluster Issues Fast!
Favicon
Mastering Data Routing in Apache Camel: Leveraging the Splitter Pattern
Favicon
Exploring Core Features and Components of Apache Camel
Favicon
Practical Guide to Apache Camel with Quarkus: Building an ETL Application
Favicon
Implementation of Missing Security Header Vulnerability in Apache (Part 2)
Favicon
Join Apache Answer at CommunityOverCode Asia 2024
Favicon
Implementation of Missing Security Header Vulnerability in Apache (Part 1)
Favicon
Installing Apache, PHP, and MySQL on Oracle Linux 8
Favicon
Install LEMP LAMP LLMP LEPP LAPP or LLPP using parameters only
Favicon
Deploying an Application Using Apache as a Web Server
Favicon
My first experience with the LAMP stack
Favicon
Shades of Open Source - Understanding The Many Meanings of "Open"
Favicon
Updating the solr client(org.apache.solr.solr-core) from 8.11.2 to 9.6.0
Favicon
Automating the installation of a LAMP stack on Ubuntu 22.04
Favicon
How to setup an Apache server on Ubuntu 22.04.4 LTS with Virtual hosting
Favicon
Build a Safe and Respectful Community with Answer 1.3.1
Favicon
Apache Spark 101
Favicon
Apply for Apache Answerโ€™s Project at OSPP 2024
Favicon
Understanding Kappa Architecture and Kafka: Empowering Real-Time Data Processing
Favicon
Run Laravel locally on Ubuntu using Apache virtual host
Favicon
Deploy Sendy on AWS EC2 with Apache in Ubuntu
Favicon
Docker LAMP Stack With Composer PSR-4 Autoloading โ€“ Apache Server

Featured ones: