Let's Share

My personal place to share knowledge about Sitecore, Powershell, Amazon Web Services and .NET

How to use an AWS Relational Database Service as a Sitecore Database

posted by Robert Senktas   | 08-05-2017


Prerequsites
Before you start this tutorial you need:

a) AWS account - https://aws.amazon.com/
Note: To create AWS account you need credit card and phone for user verification.

b) Sitecore web application installer https://dev.sitecore.net/
Note: You need account with access rights to download Sitecore packages

c) Access to MSSQL server where Sitecore DB will be installed
Note: Please be sure that you have valid MSSQL credentials

Introduction

Restore RDS instance Amazon Relational Database Service (RDS) is managed relational database service with a choice of six popular database engines. Set up, operate, and scale a relational database in the cloud with just a few clicks. From July 2016 Amazon RDS for SQL Server now supports SQL Server Native Backup/Restore using Amazon Simple Storage Service (S3). You can now take database level backups as SQL Server backup files (.bak) and store them in your Amazon S3 bucket. You can read the full post here



To configure and use Sitecore with AWS Relational Database Service (RDS), you have to perform the following steps:

  • Install a clean Sitecore databases
  • Create a bucket
  • Configure options for RDS instance
  • Create an RDS instance
  • Restore databases



Step 1 - Install a Sitecore DB on local MSSQL server

install database The first thing to check is database engine version on your environment when you plan install Sitecore DB. Next you have to check if yours database engine is supported by AWS RDS. If you are sure that your local MSSQL server is compatible with AWS RDS instances then you can install Sitecore database. The fastest way to achieve this goal is to use a Sitecore installer and choose option 'Database only'. After a few simple steps, Sitecore database is installed, then we need to create a backup for each database. Sitecore will install five databases on server – Analytics, Core, Master, Sessions and Web

Sitecore databases




Step 2 - Create MSSQL backup files

database backup I will choose MSSQL Management Studio for a backup creation. From context menu I will choose ‘Tasks’ and next ‘Backup’. I have to repeat these steps for each database.
When we create backup for each database, we have to remember two things:

  • Where database backups are stored
  • The MSSQL engine version, this is necessary to choose a proper version when we will create an RDS instance. An engine version is displayed in MSSQL Management Studio, see picture below:

database engine version







We have all necessary information to create RDS instances for Sitecore Experience Platform.


Step 3 - Create an AWS S3 bucket

This is probably the simplest step. We have to create an AWS S3 bucket to store backup files. For now RDS supports only restore backup from S3 bucket. During backup creation there is the only one important thing – you must create a bucket in the same region where we plan to create RDS instance. When bucket is ready, just copy backup files to the S3 bucket.


Step 4 - Option Group

Some DB engines offer additional features that make it easier to manage data and databases, and to provide additional security for your database.option-group Amazon RDS uses option groups to enable and configure these features. An option group can specify features, called options, that are available for a particular Amazon RDS DB instance. Options can have settings that specify how the option works. When you associate a DB instance with an option group, the specified options and option settings are enabled for that DB instance.

option-group-details By default, RDS is not able to restore a database from backup file. We have to create an option group to enable additional feature for MSSQL. Let us create an option group ‘Sitecore-Restore’ – please remember to choose a proper MSSQL engine version. Next, we have to add an option SQLSEVER_BACKUP_RESTORE. This option is necessary to restore a backup database from S3.






Step 5 - Create an AWS RDS instance.

How to create an RDS DB instance is described in details in AWS documentation. I would like to remind you about three important settings:

  • Choose proper DB Engine Version
  • Allocate storage – choose proper size of storage, this is important on production
  • Choose proper option group – created in previous step
rds-instancerds-instance-setting














Step 6 - Restore Sitecore databases from .bak files

Before we restore databases we have to connect to RDS instance via MSSQL Management Studio
Scripts to restore Sitecore databases from backup are available here. You only have to change bucket name and databases names.


Sitecore AWS RDS MSSQL S3
This is a personal blog. All opinions here are my own opinions and do not represent my employer’s view in anyway.

Sitecore Automation Module