Problem
I have heard about the Amazon Web Service cloud and I know we can run SQL Server databases there in something called RDS. I would like to know how it all works. I need to tell my manager if we can use it for any of our systems. Does it offer any security? What limitations are there? What about pricing?
Solution
In a previous tip on MSSQLTips.com, author Tim Cullen introduced readers to the Amazon Web Service (AWS) cloud platform’s Relational Database Service (RDS). In this tip, we will outline what’s involved in rolling out a SQL Server instance in RDS. In subsequent tips we will explore what features it offers and what shortcomings it has.
Before we begin, let’s talk about the two ways we can run a SQL Server instance in the Amazon cloud and what does a managed database service mean.
Amazon RDS as a “Managed Service” for SQL Server
There are two ways you can run SQL Server in the Amazon cloud. The first choice is to run it in Amazon’s compute platform called the Elastic Compute Cloud (EC2 for short). Each EC2 instance is basically a virtual server, much like the VMWare servers running in your enterprise network. With EC2 service, you can spin up a Windows Server in the AWS cloud in a matter of minutes, copy the SQL Server installers there and start the installation, just like you would when your server ops team has delivered a VM for you.
The second option is to use the Relational Database Service (RDS) which is “managed” by AWS. When we say “manage” it means you don’t have to install SQL Server yourself, it’s installed for you. You just specify a few parameters in a wizard and the server instance is created behind the scene. With the managed service, AWS takes care of the underlying storage, patching and maintenance, failover, backups, etc. However, you will not have remote desktop access to the SQL Server box. You can only access the SQL Server instance through Management Studio or other client apps.
Assumptions for SQL Server Running on Amazon RDS
Before we dive into this tip, I assume a few things about Amazon’s RDS Platform, SQL Server and you:
- Sign-up – You are already signed up for Amazon Web Service (AWS) or have access to an AWS account. If you don’t have an account, you can create one easily with a valid credit card. Follow the instructions from Tim’s tip to see how you can sign up. Don’t worry, it’s free to sign up and as long as you are not using any service, your card won’t be charged. You can even play around with the AWS services for free in the first year if you stay within the so called “free usage” tier. Amazon specifies the conditions of “free usage” on its web site. For the examples in this tip and any subsequent tips, you will incur a small fee, but you can delete the SQL Server instances when you are done. If you are using your company’s AWS account, make sure you have appropriate access rights for creating RDS instances.
- AWS Management Console – You have a basic familiarity with AWS Management Console and can navigate through different pages, choose your Region etc. We will talk about some AWS services relevant to RDS later. It would be good if you have a basic familiarity with core AWS services like Simple Storage Service (S3), Elastic Compute Cloud (EC2), Virtual Private Cloud (VPC) and Identity and Access Management (IAM). But for now, I would assume you have spent some time navigating the links in the AWS Management Console.
- Basic SQL Server Knowledge – You have a basic understanding of a SQL Server database instances. This may sound trivial to a reader of MSSQLTips.com, but if you are a developer looking for a platform to host your database or a server op who needs to know what’s involved in running a database in the cloud, I can say you don’t have to be a full blown DBA to use the Amazon platform, but it does not hurt.
Some Basic Concepts for RDS
Here are some basic concepts you need to be familiar with on Amazon RDS.
Regions and Availability Zones
AWS services are offered in different parts of the world in a decentralized fashion. The service map is divided into what’s known as AWS “Regions”. Each Region is completely separate from other Regions. For example, you have a Region in South America to service customers in that part of the world, there is one Region in Europe, three Regions in the US and so on. Depending on where you are located, you can create your AWS applications and services in your nearest Region. When you log into the AWS Management Console, you have an option to change your Region. For example, the image below shows my current Region as Sydney (ap-southeast-2):
Within Regions, we have what’s known as AZs or Availability Zones. Like any cloud service provider, Amazon hosts its servers, networking, connectivity, storage and all necessary infrastructures in dedicated data center facilities. These data centers are known as Availability Zones. Each AZ is a self-contained facility with its own power supply and backup service and is connected to other AZs in the same Region with a dedicated low latency network. There can be two or more AZs in any Region. The idea behind AZs is that of fault tolerance. You have the option to design your systems so that if applications and servers in one data center fail, they can start running from another AZ.
The concept of Regions and Availability Zones are shown below:

Virtual Private Cloud and EC2-Classic Platform
There are two types of networks your servers can run within AWS. The first one is called EC2-Classic. With EC2-Classic, you have a flat, all-encompassing network within AWS. Every server or database instance you run in EC2-Classic shares a common network space with other customers’ systems. Don’t be fooled to think it doesn’t offer any security for you though. EC2-Classic offers the same principles of security groups like the newer VPC platform.
If you have recently signed up for AWS, you would be creating systems in what’s known as a Virtual Private Cloud or VPC. A VPC is basically a separate, private network that you create within AWS. What this means is that you are essentially ring fencing your compute resources in the cloud as you would do in your corporate network. With a VPC, you can:
- Define your network’s IP address range
- Define subnets within that network
- Choose IP address ranges for hosts within the subnets
- Define routing
- Specify connectivity to the Internet
- Specify access control at the network and host level
- and more
What’s more, you can connect your on-premises network to the VPC via Virtual Private Networking or VPN, meaning your resources within AWS becomes part of your on-premises network. You can choose to keep your VPC completely private or open parts of it to the Internet, much like a DMZ.
Amazon now promotes the VPC platform as EC2 will be gradually deprecated. In fact when you sign up for a new account, you would find that AWS already provides you with a default VPC for every Region in the cloud. You can rollout your servers in this default VPC without knowing much about VPCs or networking.
You can check whether your AWS account supports the VPC platform by looking at the RDS Dashboard page in AWS Management Console. In the image below, I can see that my account only supports the VPC networking platform in the current Region. It also specifies the ID of the default VPC:

If your account in the current Region supports EC2 platform, the Supported Platforms entry would show EC2, VPC.
In this tip, we will create our RDS instance in a default VPC to keep things simple.
Security Groups on Amazon EC2 Platform
Security groups are basically firewalls within your RDS database instance. The idea of security groups come from Amazon’s Elastic Compute Cloud (EC2) service. With EC2, you can specify firewall rules at a server level that control what service ports are open for connection. For example, you could open ports 80 (HTTP) and 443 (HTTPS) in a Web Server and leave all other ports closed. Any connection coming to other ports would be refused. Similarly, if you are running SQL Server in an EC2 instance, you could specify that only port 1433 and 3389 (for Remote Desktop) are open.
The allowing and denying of access to ports is specified in what’s known as rules. A security group is just a list of those rules. Each rule specifies what protocol is used for incoming connection, what port is used for that protocol, what’s the source of the connection and if the connection is allowed. If you think about it, this is a very strong security mechanism. Amazon does not maintain these rules at the operating system level (Windows Firewall or Linux IPTable), it’s maintained in the virtual machine level.
The concept of security groups extends to RDS database instances as well. With an RDS instance, you can also specify what connections are allowed for your database instance. However, the type of security group you create for RDS will depend on whether you are using EC2-Classic or EC2-VPC.
Security groups can be created in both EC2-Classic and EC2-VPC networking platforms, but they are different in their capacities and one can’t be used for the other. What this means is that if you have created an EC2-Classic security group, it can’t be used in a VPC and vice versa.
Since the VPC is preferred and the default networking platform for AWS going forward, we have assumed that you would be creating your RDS instances in the VPC.
To make it all clear, see the image below. I have created a security group in the default VPC for the current Region. The security group is called “db-server-security-group”. It has both inbound (ingress) and outbound (egress) rules. The source field says “0.0.0.0/0”, which is the CIDR (Class-less Inter Domain Routing) address for the whole (outside) world or Internet. This means the security group would accept connections ONLY on TCP port 1433 (default for SQL Server) from anywhere. Now you wouldn’t want this for your production system (or even non-production system), but this is for demonstration purposes. In practical cases, the source or the destination field would contain the public IP address block of your corporate network, or the ID of another security group. The second SG could be your application server, so in effect you would be granting your application server access to your database server only.