DEV Community

Cover image for Let's dive into AWS, and understand the concepts of EC2, and create an instance to deploy our first application
Izuabueke Davidson  Anujulu
Izuabueke Davidson Anujulu

Posted on

Let's dive into AWS, and understand the concepts of EC2, and create an instance to deploy our first application

WHAT IS EC2?

EC2 (Elastic Cloud Compute) is one of the most widely used and one of the most popular services that AWS provides. It allows users to rent virtual computers on which to run their own computer applications; it is elastic in nature, and because of that, it allows scalable deployment of applications by providing flexible and on-demand computing capacity.

EC2 instance types and their primary use cases:

  • General Purpose: These instances offer a balanced mix of compute, memory, and networking resources, making them suitable for a wide range of applications, such as web servers and databases. Examples include:

    • M4, M5, M5n, M5zn, M6a, M6g, and M6i
  • Compute Optimized: These instances are designed for workloads that require high-performance processing, such as batch processing, scientific simulations, and high-traffic web servers. Examples include:

    • C4, C5, C5n, C5a, C6a, C6g, and C7g
  • Memory Optimized: These instances are ideal for workloads that require large amounts of memory, such as databases, data analytics, and caching. Examples include:

    • R4, R5, R5b, R5n, X1, X1e, and z1d
  • Storage Optimized: These instances are designed for workloads that require high-performance storage, such as databases, data warehouses, and file systems. Examples include:

    • I3, I3en, D2, and H1
  • Accelerated Computing: These instances use hardware accelerators, such as GPUs, FPGAs, or ASICs, to accelerate specific workloads, such as machine learning, scientific simulations, and data analytics. Examples include:

    • P2, P3, P4, G4, F1, and Inf1

Some key features of EC2:

  • Virtual Machines: EC2 provides virtual machines, known as instances, which can be used to run applications.
  • Scalability: EC2 allows users to scale up or down to handle changes in workload or traffic.
  • Flexibility: EC2 provides a range of instance types, including different sizes, types, and configurations.
  • On-demand: EC2 provides on-demand computing capacity, allowing users to quickly deploy and terminate instances as needed.
  • Security: EC2 provides a secure environment for running applications, with features such as firewall rules, access controls, and encryption.
  • Integration: EC2 integrates with other AWS services, such as S3, RDS, and VPC, to provide a comprehensive cloud computing platform.

EC2 instances use case:

  • Web servers: Running web servers, such as Apache or Nginx.
  • Databases: Running databases, such as MySQL or PostgreSQL.
  • Application servers: Running application servers, such as Tomcat or JBoss.
  • Batch processing: Running batch processing jobs, such as data processing or scientific simulations.
  • Machine learning: Running machine learning workloads, such as training models or making predictions.

Step-by-step guide to creating and deploying application

  • Log into the browser and search for AWS Console.

  • Create your account.

  • Log into the account after the creation. You will see something like the environment below.
    environment

  • in the search box, search for EC2 and select Virtual Servers in the Cloud.
    Image description

  • To create an instance, you will see Launch instance at the top right side or scroll down, You will see Launch instance, then click on it.
    Image description

  • click the box and give your instance a name e.g my "project"
    Image description

  • click the Add additional tags button to add a tag to the instance. Tags are important and a good practice for identification.
    Image description

  • below is the display of the tag box information
    Image description

  • on the top right side you will see Stockholm click on it and choose Region.
    Image description
    Note: Why choose Region and availability zones The choice of region is important because of these

  • Company/government policy: the company may have a restriction that they don't want to put their data outside their country or zone

  • Latency: Latency is the time it takes for the request to reach an application and for the application and server to send a response back to you, if there is a delay that means there is high Latency, if there is no delay it means there is low Latency. For low Latency, creating your instance in the nearest availability zone is recommended.

  • Availability zone: to avoid downtime it is recommended to put your application in two availability zones so that if one is down the other will be working.

  • Scroll to the Application or OS image region to select the type of Image suitable for your operation

Image description

  • Select the kind of Instance that won't cost so much

Image description

  • Create a Key Value Pair by clicking on create and provide a name Note: The key-value pair or key pair is the most important thing and this key pair is the one that helps us to log into the instance, by default when you create an instance AWS does not provide your password, the password authentication to the instance is disabled by default the only way you can log into the instance is using key-value pair, what is key-value pair, it is the combination of the public-private key which you used to log into a specific instance, so the instance has a public key you will have the private key, using the private key you will log into the instance. Image description Image description
  • On the Network Security, Select Allow HTTP from the internet Image description
  • On the Configure Storage, you can increase the memory. Image description
  • Click the Launch icon. Image description
  • It has successfully launched.
    Image description

  • Click on RDP Client Icon.
    Image description

  • Click on Download Remote Desktop file.
    Image description

  • Go to the Desktop file to open it up.
    Image description

  • Click on the Get password.
    Image description

  • Click on upload a private key file.

Image description

  • Click on the Key Pair Downloaded and Open. Image description
  • After the Download of the Key Pair, Decrypt the Password. Image description
  • The Password after being Decrypt. Copy it, and Go to RDP File that has been downloaded to connect the EC2 Instance. Image description

Image description

Image description

  • This is your instance environment. Image description
  • on the search bar search for PowerShell in the EC2 instance environment, and run it as an Administrator. Image description
  • On the PowerShell terminal install IIS webserver by running install-WindowsFeature -Name Web-Server -IncloudeManagementTools Image description
  • Return to the instance you created copy your Public IP address and paste it into Browser. Image description
  • The environment of the Browser.

Image description

Conclusion
By completing the steps in this guide, you have successfully set up a Windows EC2 instance on Amazon Web Services (AWS) and installed the Internet Information Services (IIS) web server. This accomplishment showcases the versatility and capabilities of AWS, providing a solid groundwork for hosting web applications in a cloud environment. With your IIS server now operational, you can proceed to customize configurations, deploy websites, and scale your instance as needed to accommodate increasing demands

Top comments (0)