Wednesday, December 11, 2024
No menu items!
HomeDatabase ManagementIntegrate Amazon RDS Custom for Oracle with Amazon EFS

Integrate Amazon RDS Custom for Oracle with Amazon EFS

As customers migrate their Oracle databases to the AWS Cloud, they often need a shared file system to be available on their Oracle database systems either to share files between the database and application servers or as a staging location to keep backups, data loads, and more.

Amazon RDS Custom automates database administration tasks and operations, while making it possible for you as a database administrator to access and customize your database environment and operating system. With RDS Custom, you can customize to meet the requirements of legacy, custom, and packaged applications.

Amazon RDS Custom for Oracle supports integration with Amazon Elastic File System (Amazon EFS), which provides a simple, serverless, set-and-forget elastic file system that lets you share file data without provisioning or managing storage. It’s built to scale on demand to petabytes without disrupting applications.

Amazon RDS Custom for Oracle with Amazon EFS is well suited to support a broad spectrum of use cases, such as the following:

Use it with applications that need a shared file system between application and database servers
Mount Amazon EFS on an RDS Custom for Oracle instance in multiple Availability Zones, so files can be shared and accessed with ease
Use it as an upload location for the native dumps and backups required for migration
Store and share RMAN backup and recovery logs without allocation of additional storage space on the server

In this post, we walk you through a step-by-step configuration to set up Amazon EFS on an RDS Custom for Oracle database instance. We also talk about the benefits of doing such an integration and best practices to consider while doing so.

Solution overview

The following diagram illustrates our solution architecture:

We walk you through the following high-level steps:

Connect to your RDS Custom for Oracle EC2 instance and install the NFS client.
Mount the file system on your instance.
Configure automatic remounting of the file system upon reboot of the instance.
Take a manual snapshot of the instance.

Benefits of integrating an RDS Custom for Oracle instance with Amazon EFS

This integration has the following key benefits:

Faster migration by using Amazon EFS mounted on RDS Custom for Oracle DB instances as a landing zone for various Oracle files required for migration or data transfer.
Using it as a landing zone also helps to save allocation of extra storage space on the instance to hold the files.
There are no minimum fees or setup costs, and you pay only for what you use.
It provides consistent performance to each compute instance. It’s designed to be highly durable and highly available.
The file systems can automatically scale from gigabytes to petabytes of data without needing to provision storage.

Prerequisites

You must have the following prerequisites:

An RDS Custom for Oracle database up and running. For instructions, see Amazon RDS Custom for Oracle – New Control Capabilities in Database Environment.
A connection to your RDS Custom for Oracle EC2 instance using SSH or AWS Systems Session Manager.
An existing or new Amazon EFS file system.
Familiarity with Linux OS and Amazon RDS for Oracle.

Connect to your instance and install the NFS client

To connect to your instance from a computer running macOS or Linux, specify the .pem file for your SSH command with the -i option and the path to your private key.

To connect to your instance from a computer running Windows, you can use either ››MindTerm or PuTTY. If you plan to use PuTTY, you need to install it and use the following procedure to convert the .pem file to a .ppk file.

Run the following commands on the RDS Custom for Oracle EC2 instance by using the SSH session to get updates and reboot:

sudo yum -y update
sudo reboot

After the reboot, reconnect to your RDS Custom for Oracle EC2 instance and install the NFS client:

sudo yum -y install nfs-utils

Mount the file system on your instance

On the RDS Custom for Oracle EC2 instance, make a directory where you want to mount the Amazon EFS file system. In the following command, we use efs-mount-point:

mkdir ~/efs-mount-point


Mount the file system with the following code:

sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrains=2 fs-11223344556677889.efs.us-east-2.amazonaws.com:/ /home/ssm-user/efs-mount-point


The instance can resolve the mount target DNS name to the IP address. You can optionally specify the IP address of the mount target directly.

You need to replace /home/ssm-user/efs-mount-point with the path of the directory you created.

Now that you have the file system mounted on your instance, you can check the file systems as shown in the following screenshot.

Next, change the directory to /home/ssm-user/efs-mount-point:

cd /home/ssm-user/efs-mount-point

List the contents of the directory.

It should be empty.
The root directory of a file system, upon creation, is owned by and writable by the root user, so you need to change permissions to add files:

sudo chmod go+rw

Now, if you try the ls -al command, you see that the permissions have changed.

Create a text file:

touch test-file.txt

List directory content:

Configure automatic remount of the file system on reboot of the instance

To automatically remount your Amazon EFS file system directory when the RDS Custom for Oracle EC2 instance reboots, use the file /etc/fstab. The file contains information about file systems. The command mount -a, which runs during instance startup, mounts the file systems listed in /etc/fstab. This procedure uses the Amazon EFS mount helper to mount the file system, which needs to be installed on the instance.

Make a copy of the /etc/fstab file and edit the file using the following command:

sudo cp /etc/fstab /etc/fstab.bkup
sudo vi /etc/fstab

Make sure the /etc/fstab file reflects the exact path of your Amazon EFS directory . For this use case, the Amazon EFS directory is under /home/ss-user/efs-mount-point. Also, make sure you replace the file system identity with your specific file system.

Add the following entry to /etc/fstab:

/home/ssm-user/efs-mount-point nfs4 defaults,_netdev 0 0

Test the fstab for any errors using the following command:

sudo mount -fav

If you see any errors, check the /etc/fstab file entries.
You can now reboot your instance and the file system will be mounted automatically.

Take a manual snapshot of your instance

As a best practice, create an RDS Custom snapshot of your database so you can restore the instance settings in case of a DB instance crash.

RDS Custom creates a storage volume snapshot of your DB instance, backing up the entire DB instance and not just individual databases. When you create an RDS Custom snapshot, specify which RDS Custom DB instance to back up. Give your snapshot a name so you can restore from it later. Check the following code:

aws rds create-db-snapshot
–db-instance-identifier my-custom-instance
–db-snapshot-identifier my-custom-snapshot

After the database is restored from the snapshot, you need to still follow the process to manually mount the Amazon EFS volume. 

If you have to unmount the volume, run the following command:

umount -f /home/ssm-user/efs-mount-point

Make sure you replace the path to the Amazon EFS directory with your own specific path.

Best practices and recommendations

Keep in mind the following when implementing this integration:

Don’t use Amazon EFS mounted on RDS Custom for Oracle DB instances for database files.
The Amazon EFS entry should be in the /etc/fstab file in order to automatically mount it after instance reboot.
You mount your file system from the instance in your Amazon VPC by using the mount targets you create in the VPC. You can also mount your file system on your EC2-Classic instances, which are not in the VPC. However, you must first link them to your VPC by using ClassicLink.
Be aware of Amazon EFS quotas and limits.

Conclusion

In this post, we learned how to configure and use Amazon EFS with Amazon RDS Custom for Oracle. Now you can use the Amazon EFS file system to load and unload data, and make database migration even faster by using Amazon EFS to store the RMAN recovery files and export dump files. You can also use Amazon EFS as a landing zone for all your file storage needs.

To learn more about Amazon RDS Custom and Amazon EFS, refer to the following resources:

Amazon RDS Custom pricing
Amazon RDS Custom User Guide
Amazon Elastic File System Documentation

About the Authors

Vineet Agarwal is a Senior Database Specialist Solutions Architect with Amazon Web Services (AWS). Prior to AWS, Vineet has worked for large enterprises in financial, retail and healthcare verticals helping them with database and solutions architecture. In his spare time, you’ll find him playing poker, trying a new activity or a DIY project.

Yamuna Palasamudram is a Senior Database Specialist Solutions Architect with Amazon Web Services. She works with AWS RDS team, focusing on commercial database engines like Oracle. She enjoys working with customers to help design, deploy, and optimize relational database workloads on AWS.

Read MoreAWS Database Blog

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments