Recently I worked on a requirement with an AWS customer who is running SQL Server on EC2 instances (unmanaged) wherein Dev/QA teams who require multiple copies of production SQL database. They want to test the application code, execute queries, validate schema changes, run performance testing, and more. Sounds a familiar use case, right?
Let’s take a step back and review the overall process. Developers require the production database in the development environments. Usually, a restore of the production database backup is performed into development and users are given access to perform their operations. This is time consuming as it involves either restoring from snapshots or using different disk mechanisms either of which affects the overall time and effort.
However, this customer knew exactly what he wanted. Yes, I am talking about Amazon FSx for NetApp ONTAP. FSx for ONTAP exposes enterprise class features that customers have been using on premises within their AWS VPCs to create temporary, writable copies for any given use case. The clones reflect the current, point-in-time state of the data and there is no initial copy process or lazy restores from S3 required. These clones, which can also be application consistent clones, can give additional users access to data without giving them permissions to the production data.
This is a big and effective use case that can be easily achieved using FSx for ONTAP, which is an AWS first party service and that’s the beauty it brings to the table. There are many customers exploring and using this functionality today in AWS for SQL servers running on EC2 instances. Keep in mind, the same use case is applicable for any other database.
In this blog, let’s dive deep into this specific scenario and the steps involved so it can be easily replicated in your environment. Clone creation is possible via FSx for ONTAP CLI which will be crash consistent, however we focus on using NetApp SnapCenter® software (application-consistent database backup management) with SQL Server on EC2 with Amazon FSx for NetApp ONTAP for creating clones for test/development and the clone lifecycle management capability which provides automatic, scheduled cloned database resynchronization and deletion.
With the NetApp SnapCenter clone workflow, you can bring up SQL databases nearly instantly in AWS and verify the cloned database for consistency and data integrity. This is a great way for DevOps teams to quickly verify how things will work during a rollout or while troubleshooting production issues without consuming additional storage space due to the efficiency of FlexClone capability in FSx for ONTAP. Cloning and shutting down the database is a quick and easy process that you can perform as often as needed. This is completely isolated from the production environment, which means production access continues as normal while validation efforts progress on the other side. Clones can also be created using crash-consistent storage Snapshot copies.
The steps to create clones is as follows:
The process is as simple as that and can also be achieved using PowerShell. This is the capability that AWS and NetApp brings to the table: a reduction in development and test cycles, an improvement in the time to market, less use of storage capacity, and a minimization of administrative and management tasks.
Now how about scheduling recurring clone operations aka Clone life cycle. The process is straight forward.
This will create a clone job that can be accessed and modified by selecting the database or resource group and click on Details.
Note: During a clone life cycle workflow, a new snapshot is created with copy only option within SnapCenter.
Cloned database can be easily split from the parent resource if it needs to be made an independent copy. The clone that is split becomes independent of the parent resource.
That covers the clone operation procedure.
Now, let’s double-click on pre- or post-script option against a clone database. This can be for data movement/notification requests like automating alerts, sending logs, or for data modification requirements like deleting or hiding a table or a column within the database or even for data masking approaches. Data masking use case is outside of the scope of this blog and will be covered in a future blogpost.
All prescripts and postscripts that are run as part of SnapCenter operations are executed on the plug-in host. Therefore, the scripts must be located on the plug-in host or on a SMB share accessible by the plug-in host. The script path is validated at the time the script is executed. Scripts are specified in backup or clone job policies. When a clone job is started, the policy automatically associates the script with the resources being cloned. A single script can be coded as both a prescript and a postscript and can call other scripts.
To enable pre- or post-scripts using PowerShell in the appropriate clone jobs, these 3 pre-requisites should be met.
Note: With this approach, there is no need to specify passwords in the script as it would use windows authentication in the PowerShell connection string.
Recently a customer chose to deploy SQL Server databases running on EC2 on FSx for ONTAP to leverage Snapshots and clone functionality and reduced their cloning time from hours to minutes along with boosting their production performance. Another customer chose to deploy SQL Server Availability groups (AOAG) in a storage hybrid model with one copy of the database residing on EBS and the second copy residing on FSx for ONTAP to strictly meet their cloning requirements. Clone life cycle solved their pain point and enabled them to ease their migration efforts while focusing on infrastructure optimization rather than worrying about clone jobs.
To summarize, Amazon FSx for NetApp ONTAP along with a SQL Server database enables you to run production database in AWS with high performance, data protection, database cloning, and block-based disaster recovery capabilities, allowing you to avoid what used to be a long and cumbersome process.
In this blog, we provided detailed step by step guidance of clone life cycle using SnapCenter while using FSx for ONTAP as a storage option for SQL Server running on an EC2 instance.
Thank you for reading this blog post! If you have any comments or questions, don’t hesitate to leave them in the comments section.