Query regarding MS SQL EC2 instance, and putting Temp DBs on the instance stores

We have a Dev MS SQL Server running on EC2. The servers are only available 8AM - 7PM. Typically our DBAs like to put the temp dbs on the Instance Store (Z: drive usually). The issue with this is two fold:

  1. the instance store may not be ready in time that SQL starts, so the SQL service does not start
  2. as the instance store is effectively different each time, permissions on the drive have to be assigned to allow the SQL instance to create the DBs on that drive (which negates 1 essentially).

Does anyone have any suggestions on how we can mitigate this? My first instinct was a Powershell script at startup to assign perms, but the timing issue rules this out essentially. Much obliged in advance.


Related discussions:

Why is this the situation you find yourselves in? Why not a small RDS instance, for example?

And why are you using instance stores? Could you not use EBS volumes instead, and just stop/start instances? This would make this a non-problem

All valid questions. We’re not using RDS because our DBAs don’t want it, and in fairness we want to replicate Live, which will be using a MS SQL instance.

We’re using instance stores, because that’s what our DBAs want. We could use EBS vols instead - I imagine we’ll just go this route. Thanks

EBS volume would fix this whole problem. Just spin down at eve and restart in the day.

I would suggest you should try to find out why Live isnt using RDS, as well. Its substantially better, and managed for you. I’d recommend Aurora, as a bit of a fanboy.

I’m not fully aware of the ins and outs, but I know the DBAs like that they have more control over an SQL instance, rather than RDS. A partner that we’re working with mentioned some limitations with RDS that had held them back in the past too, so for the time being it’s on hold, but it is definitely something we keep assessing.

I would (personally) be interested in understanding more about the limitations you’re facing. It doesnt give you access to the underlying host, but I’m not aware of many or any reasons to NOT be using a managed database service from amazon unless you have an issue with the database itself

People whose job it is to perform a function that’s partially abstracted away by a new technology insisting on doing it “the old way?” Shocking.

I solved this problem by making all sql services manual start. I power on the db servers via powershell api calls, then use try/catch logic to wait for the instance to be online. Once its online I use powershell remoting to wait for the instance storage to become avilable. Once its available then I issue the calls to start the sql services. Im sure you could do the permissioning before the service starts as well.

Id say the script works without issue 98% of the time. Occasionally it fails and its almost always due to the instance start commands, be it ebs volume decyption issues or availability zone capacity. One time it took over 30 minutes for the instance storage to become available so it timed out there.

The major complaint I hear from my data engineers is the lack of SSIS support.

RDS has a bunch of limitations for MSSQL if the software needs those features then no amount of AWS management will make up for them. Our DBA has zero issues with RDS for non critical applications but for the more critical ones he has constant transaction log backups, which he cannot replicate faithfully using RDS.

Lack of SSIS and/or brokers kills it for some applications.

yeah that’s what I was thinking I’d need to do. However, have pushed back and the temp DBS have been moved to EBS. Much simpler. What’s outlined above doesn’t feel right to me - we’ve no control over the instance store either. I guess for servers that don’t start / stop (live) very often it’s not so much of an issue. We were trying to put page file on the instance stores too, but due to timing issues weren’t able to.

indeed. As mentioned below, I believe the constraints for us around around backups / T log backups (and possibly the retention period?) For a Dev environment this would not be an issue, but for consistency with live we would use a SQL instance instead.

It has been a while now, but I never encountered issues when I set the mssql service to automatic delayed start.

Just ensure the temp db files are not within a subfolder in the instance store

hmm that might be part of the issue we were having - the files were in a sub-folder and I seem to recall needing to manually set permissions on the folder to allow the SQL server write permission (SQL running under a service account, rather than system).

Perhaps inherently there will be the perms issue, if running as a service account rather than local system?

So on one instance we intentionally created the tempDB folders under a subfolder, and from what we encountered there were NO permissions issues, but SQL would not create the folder structure, so creating it manually/scripted would get the service to start again.

We never encountered ANY issues, permissions or otherwise when setting the service to Automatic (Delayed) and placing the tempdb files directly on the drive (no subfolder).

In fact this is part of our best practice setup for servers.

cool, thanks for your input, I think this will work for us, and is a good way to make use of instance store. will try again Monday (we have a DB server that starts/stops daily so we’ll soon see how we get on!)

we’ve tried this and it’s not worked :confused: Are you running SQL as local system / user account with admin privileges? We’re running it as a Managed Service Account, and after the instance has rebooted, the Service Account does not have the requisite permissions to create files on the Z: drive.