Step-by-Step Guide: Creating an ECS Instance and Connecting Seamlessly

Step-by-Step Guide: Creating an ECS Instance and Connecting Seamlessly

Amazon EC2 is a cornerstone service in the AWS ecosystem, offering scalable computing capacity in the cloud. Whether you're a seasoned cloud architect or just getting started with AWS, understanding how to provision and connect to EC2 instances is essential. In this step-by-step tutorial, we'll walk you through the process of launching an EC2 instance on the AWS Management Console and connecting to it from your local machine. By the end of this guide, you'll have the confidence to spin up EC2 instances effortlessly and manage them effectively for your cloud-based projects.

Pre-requisites to start

  1. You should have your AWS Account to create your own EC2 instance and connect with it remotely. If you are creating a new AWS account then try to get a free tier which will have lots of benefits.

  2. Any operating system can be used to connect to the EC2 instance, but it's preferable to use a Linux distribution because it typically comes with built-in SSH support. However, for the purpose of this tutorial, we'll be using Git Bash on Windows as our client for connecting to the EC2 instance.

How to Create an EC2 Instance?

Here are the steps that you should follow to create a new EC2 instance.

  1. Go to your AWS console and search ec2 in the search console.

  2. Go to the EC2 option and create a new Instance by clicking on the Launch Instance option.

  3. Create a new Instance by filling in the correct information like naming the server, choosing an OS image that you want to be installed on the server, and Then create a login key pair by clicking create a new key pair option.

It will downoad .pem file which is RSA key which will help us to connect to our server

  1. Now in the network tab, you can select either SSH traffic which will only help us to connect to our ec2 instance with our workspace.

  1. Then Launch an instance and it will create an instance and then we will move further towards connecting the ec2 with our workspace.

How to connect EC2 from a remote setup?

Below are some steps to connect to your EC2 instance from Windows using Git Bash. While tools like PuTTY are also available, it's important to note that in real-world scenarios, you'd often use a Linux-based system since most servers run on Linux distributions. Here's how you can mimic this setup in Windows using Git Bash or utilize the Windows Subsystem for Linux (WSL):

  1. Install git bash if you don't have it in your system and then follow the given command to connect.

  2. Now move your .pem file in the folder from where you want to excess the instance for a further bit.

  3. Now open your git bash and navigate to the folder where you kept the .pem file.

  4. Now run the given command in the shell after getting to the respective folder.

 ssh -i {your keypair}.pem ubuntu@{server-ip}

In most condition, you won't find a lot of error here and you will get the access to your instance and a terminal.

If you've followed along with this blog until now, congratulations! You've successfully connected to your instance. In the upcoming videos in this series, we'll take the next steps by uploading our server and exploring additional AWS services like S3, CloudFront, and more. I hope you've found this blog informative and valuable. Stay tuned for more exciting content, and happy coding!


Did you find this article valuable?

Support Vishal Sharma by becoming a sponsor. Any amount is appreciated!