Deploy Drupal with Amazon RDS
TUTORIAL
Module 2: Creating an EC2 Instance
You will create an Amazon EC2 instance to run your Drupal site
Overview
In this module, you will create an Amazon EC2 instance to run your Drupal site. Amazon EC2 provides highly-configurable server instances on-demand. On an EC2 instance, you can run a Drupal site that will be accessible by users anywhere.
Why use Amazon EC2 for your Drupal site
When getting started with Drupal, you may test it out by installing and running it on your laptop or desktop. This is fine for a test but you will quickly hit its limitations. Your Drupal site will only be running as long as your laptop or desktop is running. Further, the site will only be accessible by you -- it won’t be available over the public internet.
A better approach is to use a server. In the steps below, you will launch an EC2 instance to host your Drupal site.
Time to Complete
10 minutes
Services Used
Implementation
Security groups are networking rules that describe the kind of network traffic that is allowed to your EC2 instance. You want to allow HTTP and HTTPS traffic to your instance so that you can view your Drupal site.
Go to EC2 > Security Groups and create a new security group with the following configuration.
- Security group name: Drupal EC2 SG
- Description: Security Group for accessing Drupal Instance
- VPC: Default VPC
- Inbound Rules:
- Type: HTTP | Source: Anywhere-IPv4
- Type: HTTPS | Source: Anywhere-IPv4
- Tags:
- Key: Name
- Value: Drupal EC2 SG
After providing all the necessary details, click on "Create security group" button. This action will create a security group that can be utilized as part of the EC2 instance provisioning process. Create Drupal EC2 instance
To create your EC2 instance, go to Amazon EC2 in the AWS console. Click the button that says Launch instance to open the instance creation wizard.
On this page, you will choose an Amazon Machine Image (“AMI”). The AMI you choose will determine the base software that is installed on your new EC2 instance. This includes the operating system (Amazon Linux, Red Hat Enterprise Linux, Ubuntu, Microsoft Windows Server, etc.), as well as the applications that are installed on the machine.
The Amazon Linux 2023 distro is a popular choice. Choose that option in the AMI selection view.
You will then select an EC2 instance type. An instance type is a particular configuration of CPU, memory (RAM), storage, and network capacity.
AWS has a huge selection of instance types that cover many different workloads. Some are geared toward memory-intensive workloads, like databases and caches, while others are aimed at compute-heavy workloads like image processing or video encoding.
Amazon EC2 allows you to run 750 hours per month of a t2.micro instance under the AWS Free Tier. Select this option for this lab so that you won’t incur any costs on your bill.
Select the instance type as t2.micro
Next, select key pair as “Proceed without a key pair” option
From Network settings, choose “Select existing security group” and select the newly created security group “Drupal EC2 SG” from the “Common security groups”.
Your configuration should look like the following :
- Name: My-Drupal-Instance
- AMI: Amazon Linux 2023 AMI
- Key Pair Name: Proceed without a Key Pair (We’ll use AWS Session Manager instead)
- Firewall (security groups): Select existing Security Group that was created in the previous section
- Common security groups: Drupal EC2 SG
Next, from the right side “Summary” section click the button that says “Launch instance”.
You have successfully launched your EC2 instance. In the next module, we will configure your RDS database to work with your EC2 instance.