Voiced by Amazon Polly |
An ABC Organization host web application on EC2 instance to capture form data in an RDS database. Users of an application will fill & submit the form and then their data will be stored in an RDS database. An ABC Organization need to establish connection between EC2 instance to RDS database to move data from EC2 instance to RDS database.
Maximize Performance and Minimize Throughput Costs with Amazon Dynamo DB
- Developer friendly
- Automatic backup and restore
- Cost effective
Architecture
Prerequisites
Before proceeding, ensure you have:
- An AWS account with appropriate permissions.
- A VPC with public and private subnets.
- An existing or new RDS database (MySQL, PostgreSQL, or another supported engine) in private subnet.
- An existing or new EC2 instance in public subnet.
- Both RDS instance and EC2 instance in same VPC.
Step 1: Launch an EC2 Instance (If not created already)
- Go to the EC2 Console
- Navigate to the AWS EC2 Console.
- Click on “Launch Instance.”
- Choose an AMI (Amazon Machine Image)
- Select Amazon Linux, Ubuntu, or any other Linux distribution.
- Select an Instance Type
- Choose an instance type suitable for your workload (e.g., t2.micro for small applications).
- Add a Key Pair
-
- Choose or create an SSH key pair for remote access.
- Configure Network Settings
-
- Ensure the instance is in the same VPC as your RDS database.
- Enable Auto-assign Public IP if external access is required.
- Launch the Instance.
Step 2: Create an RDS Database (If Not Already Created)
- Go to the RDS Console. Open the AWS RDS Console.
- Click on “Create Database.”
- Choose the Database Engine. Select MySQL, PostgreSQL, or another database type.
- Template
- Availability and durability
- Credentials Settings
- Instance configuration
- Storage
- Configure Network Settings
- Place the database in the same VPC and subnet as the EC2 instance.
- Ensure Public Access is disabled for security reasons.
- Launch the Database and wait for it to become available.
Step 3: Configure Security Groups
Modify EC2 Security Group
- Go to the EC2 Console → Security Groups.
- Find the security group associated with your EC2 instance.
- Click Edit outbound rules → Add Rule:
- Type: MySQL/Aurora (or PostgreSQL, depending on DB engine).
- Protocol: TCP.
- Port: 3306 (for MySQL) or 5432 (for PostgreSQL).
- Destination: The security group of the RDS instance.
- Save the rule.
Modify RDS Security Group
- Go to the RDS Console → Security Groups.
- Find the security group for your RDS instance.
- Click Edit inbound rules → Add Rule:
- Type: MySQL/Aurora (or PostgreSQL).
- Protocol: TCP.
- Port: 3306 or 5432.
- Source: The security group of the EC2 instance.
- Save the rule.
Step 4: Connect EC2 Instance to RDS
- SSH into the EC2 Instance. Once your EC2 instance is running, connect via SSH:
1 |
ssh -i your-key.pem ec2-user@your-ec2-public-ip |
- Install a Database Client
For MySQL:
1 |
sudo yum install -y mysql |
For PostgreSQL:
1 |
sudo yum install -y postgresql |
- Connect to RDS Database
For MySQL:
1 |
mysql -h your-rds-endpoint -u your-db-user -p |
Enter password of database
For PostgreSQL:
1 |
psql -h your-rds-endpoint -U your-db-user -d your-db-name |
- If the connection is successful, you will see a list of available databases.
Save Time and Money with Automated and Customizable Data Insights
- Highly Scalable
- Cost- effective
- Smart Visualizations
About CloudThat
CloudThat is a leading provider of Cloud Training and Consulting services with a global presence in India, the USA, Asia, Europe, and Africa. Specializing in AWS, Microsoft Azure, GCP, VMware, Databricks, and more, the company serves mid-market and enterprise clients, offering comprehensive expertise in Cloud Migration, Data Platforms, DevOps, IoT, AI/ML, and more.
CloudThat is the first Indian Company to win the prestigious Microsoft Partner 2024 Award and is recognized as a top-tier partner with AWS and Microsoft, including the prestigious ‘Think Big’ partner award from AWS and the Microsoft Superstars FY 2023 award in Asia & India. Having trained 650k+ professionals in 500+ cloud certifications and completed 300+ consulting projects globally, CloudThat is an official AWS Advanced Consulting Partner, Microsoft Gold Partner, AWS Training Partner, AWS Migration Partner, AWS Data and Analytics Partner, AWS DevOps Competency Partner, AWS GenAI Competency Partner, Amazon QuickSight Service Delivery Partner, Amazon EKS Service Delivery Partner, AWS Microsoft Workload Partners, Amazon EC2 Service Delivery Partner, Amazon ECS Service Delivery Partner, AWS Glue Service Delivery Partner, Amazon Redshift Service Delivery Partner, AWS Control Tower Service Delivery Partner, AWS WAF Service Delivery Partner, Amazon CloudFront, Amazon OpenSearch, AWS DMS and many more.
To get started, go through our Consultancy page and Managed Services Package, CloudThat’s offerings.

WRITTEN BY Avinash Singh Bundela
Comments