top of page

How To Create AWS EC2 Instance (Centos)

Creating an EC2 instance of CentOS on Amazon Web Services (AWS) involves several steps. Here's a step-by-step guide to help you get started:


Prerequisites:

1. An AWS account. If you don't have one, you can sign up for an AWS account at [aws.amazon.com](https://aws.amazon.com/).

2. The AWS Command Line Interface (AWS CLI) installed and configured with your AWS credentials. If you haven't configured the AWS CLI, follow [this guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html).


Step 1: Sign in to the AWS Management Console


1. Go to the [AWS Management Console](https://aws.amazon.com/).

2. Sign in with your AWS account credentials.


Step 2: Launch an EC2 Instance


1. In the AWS Management Console, navigate to the EC2 service by clicking on "Services" and then selecting "EC2" under the "Compute" category.


2. Click the "Launch Instance" button to start the instance creation process.


Step 3: Choose an Amazon Machine Image (AMI)


1. In the "Choose an Amazon Machine Image (AMI)" step, you'll be prompted to select an AMI. Search for a CentOS AMI. You can use the search bar or browse the "AWS Marketplace" or "Community AMIs."


2. Select the CentOS AMI of your choice. Make sure it's the desired version and architecture.


3. Click the "Select" button to proceed.


Step 4: Choose an Instance Type


1. In the "Choose an Instance Type" step, you can select the instance type that best fits your requirements. You can choose from a variety of instance types with different CPU, memory, and storage configurations.


2. After selecting an instance type, click the "Next: Configure Instance Details" button to proceed.


Step 5: Configure Instance Details


1. In this step, you can configure instance details such as the number of instances, VPC settings, and other advanced options. You can leave most options as default for a basic setup.


2. Click the "Next: Add Storage" button to continue.


Step 6: Add Storage


1. In the "Add Storage" step, you can configure the size and type of the root volume. The default settings are usually sufficient for most use cases.


2. Click the "Next: Add Tags" button to proceed.


Step 7: Add Tags (Optional)


1. You can add tags to your instance for better organization and management. Tags are key-value pairs that help you identify resources.


2. Click the "Next: Configure Security Group" button to continue.


Step 8: Configure Security Group


1. In the "Configure Security Group" step, you can configure the security group rules that control inbound and outbound traffic to your instance. Create a new security group or use an existing one.


2. Define the rules to allow access to your instance, typically including SSH (port 22) for remote access.


3. Click the "Review and Launch" button to proceed.


Step 9: Review and Launch


1. Review your instance configuration to ensure it's correct.


2. Click the "Launch" button when you're ready to create the instance.


Step 10: Key Pair


1. In the "Select an existing key pair or create a new key pair" dialog, you can choose an existing key pair or create a new one.


2. If you choose to create a new key pair, provide a name for it and click the "Download Key Pair" button. Save the private key file (.pem) to a secure location because you'll need it to connect to your instance.


3. Click the "Launch Instances" button.


Step 11: View Instances


1. Your EC2 instance is now being launched. You can monitor the status of your instance from the "View Instances" section in the AWS Management Console.


Step 12: Access Your CentOS Instance


1. Once the instance is in the "running" state, you can access it using SSH.

siddhesh@MacBook-Air ~ % ssh -i Download/private.pem  centos@13.45.32.222
Last login: Thu Oct 19 16:53:46 2023 from 110.226.179.167
[centos@siddhesh ~]$ sudo su -
Last login: Thu Oct 19 16:53:33 UTC 2023 on pts/1
[root@siddhesh ~]#

Replace "Download/private.pem" with the path to your private key file and "13.45.32.222" with the public IP or DNS name of your EC2 instance.


You now have a CentOS-based EC2 instance up and running on AWS. You can further configure and customize the instance to meet your specific needs.

bottom of page