Database in Amazon EC2

Today we are going to look at what it takes to get a 12c database instance up and running in Amazon EC2. Note that this is different than our previous posts on getting Standard Edition running on Amazon and running Enterprise Edition running on Amazon RDS. We are going to take the traditional approach as if we were installing the database on a virtual image like VMWare, HyperV, or OracleVM. The approach is to take IaaS and layer the database upon it.

There are a few options on how to create the database instance. We can load everything from scratch, we can load a pre-defined AMI, we can create a golden image and clone it, we can do a physical to virtual then import the instance into the cloud, or we can create a Chef recipe and automate everything. In this blog we are going to skip the load everything because it is very cumbersome and time consuming. You basically would have to load the operating system, patch the operating system, create users and groups, download the binaries, unpack the binaries, manage the firewall, and manage the cloud port access rights. Each of these steps takes 5-30 minutes so the total time to get the install done would be 2-3 hours. Note that this is much better than purchasing hardware, putting it in a data center, loading the operating system and following all the same steps. We are also going to skip the golden image and cloning option since this is basically loading everything from scratch then cloning an instance. We will look at cloning a physical and importing into the cloud in a later blog. In this blog we are going to look at selecting a pre-defined AMI and loading it.

One of the benefits of the Marketplace model is that you get a pre-defined and pre-configured installation of a software package. Oracle provides the bundle for Amazon in the form of an AMI. For these instances you need to own your own perpetual license. It is important to understand the licensing implications and how Oracle defines licensing for AWS. Authorized Cloud Environment instances with 4 or fewer virtual cores are counted as 1 socket, which is considered equivalent to a processor license. For Authorized Cloud Environment instances with more than 4 virtual cores, every 4 virtual cores used (rounded up to the closest multiple of
4) equate to a licensing requirement of 1 socket. This is true for the Standard Edition license. For the Enterprise Edition license the assumption is that the cloud processor is an x86 chip set to a processor license is required for every 2 virtual cores. All of the other software like partitioning, diagnostics, tuning, compression, advanced security, etc also need to be licensed with the same metric.

If we look at the options for AMIs available we go to the console, click on EC2, and click on Launch Instance.



When we search for Oracle we get a wide variety of products like Linux, SOA, and database. If we search for Oracle database we refine the search a little more but get other supplementary products that are not the database but products that relate to the database. If we search for Oracle database 12c we get six return values.



We find two AMIs that look the same but the key difference is that one limits you to 16 cores and the other does not. We can select either one for our tests. If we search the Community AMIs we get back a variety of 11g and 10g installation options but no 12c options. (Note that the first screen shot is the Standard Edition description, it should be the Enterprise Edition since two are listed).

We are going to use the Commercial Marketplace and select the first 12c database instance. This takes us to a screen that lets us select the processing shape. Note that the smaller instances are not allowed because you need a little memory and a single core does not run the database very well. This is one of the advantages over selecting an operating system ourselves and finding out that we selected too few cores or not enough memory. Our selections are broken down into general purpose, compute optimized, or storage optimized. The key difference is how many cores, how much memory, and dedicated vs generic IOPs to the disk.

We could select an m3.xlarge or c3.xlarge and the only difference would be the amount of memory allocated. Network appears to be a little different with the c3.xlarge having less network throughput. We are going to select the m3.xlarge. Looking at pricing we should be charged $0.351/hour for the Ec2 instance, $0.125 per GB-month provisioned or $5/month for our 40 GB of disk, and $0.065 per provisioned IOP-month or $32.50/month. Our total cost of running this x3.xlarge instance will be $395.52/month or $13.18/day. We can compare this to a similarly configured Amazon RDS at $274.29/month. We need to take into account that we will need to purchase two processor licenses of the Enterprise Edition license at $47,500 per processor license. The cost of this license over four years will be $95,000 for the initial license plus 22% or $20,900 per year for support. Our four year cost of ownership will be $178,600. Amortizing this over four years brings this cost to $3,720/month. Our all in cost for the basic Enterprise Edition will cost us $4,116.35/month. If we want to compare this to the DBaaS cost that we covered earlier we also need to add the cost of the Transparent Data Encryption so that we can encrypt data in the cloud. This module is included in the Advanced Security Module which is priced at $15,000 per processor license. The four year cost of ownership for this package is $56,400 bringing the additional cost to $1,175/month. We will be spending $5,291.35 for this service with Amazon.

If we want to compare this with PaaS we have the option or purchasing the same instance at $1,500/OCPU/month or $3,000/month or $2.52/OCPUhour for the Enterprise Edition on a Virtual Image. We only need two OCPUs because this provides us with two threads per virtual core where Amazon provides you with one thread per core. We are really looking for thread count and not virtual core count. Four virtual processors in Amazon is equivalent to two OCPUs so our cost for a virtual image will be $1.5K/OCPU * 2 OCPUs. If we go with the Database as a Service we are looking at $3,000/OCPU/month or $6,000/month or $5.04/OCPU/hour for the Enterprise Edition as a service. What we need to rationalize is the extra $708/month for the PaaS service. Do we get enough benefit from having this as a service or do we spend more time and energy up front to pay less each month?

If we are going to compare the High Performance edition against the Amazon EC2 edition we have to add in the options that we get with High Performance. There are 13 features that need to be licensed to make the comparison the same. Each of these options cost anywhere from $11,500 per processor to $23,000 per processor. We saw earlier that each option will add $1,175/month so adding the three most popular options, partitioning, diagnostics, and tuning, will cost $3,525/month more. The High Performance edition will cost us $2,000/OCPU/month or $4K/month for the virtual image and $4,000/OCPU/month or $8K/month. Again we get ten more options bundled on with the High Performance option at $8K/month compared to $8,816.35 with the AWS EC2 option. We also get all of the benefits of PaaS vs IaaS for this feature set.

Once we select our AMI, instance type, we have to configure the options. We can request a spot instance but this is highly discouraged for a database. If you get terminated because your instance is needed you could easily loose data unless you have DataGuard configured and setup for synchronous data commit. We can provision this instance into a virtual private network which is different from the way it is done in the Oracle cloud. In the Oracle cloud you provision the service then configure the virtual instance. In Amazon EC2 it is done at the same time. You do have the option of provisioning the instance into one of five instance zones but all are located in US East. You can define the administration access roles with the IAM role option. You have to define these prior to provisioning the database. You can also define operating of this instance from the console. You can stop or terminate the instance when it is shut down as well as prohibit someone from terminating the instance unless they have rights to do so. You can enable CloudWatch (at an additional charge of $7.50/month) to monitor this service and restart it if it fails. We can also add elastic block attachment so that our data can migrate from one instance to another at an additional cost.


We now have to consider the reserved IOPs for our instance when we look at the storage. By default we get 8 GB for the operating system, 50 GB for the data area with 500 provisioned IOPS, and 8 GB for log space. The cost of the reserved IOPS adds $38.75/month. If we were looking at every penny we would also have to look at outbound traffic from the database. If we read all of our 50 GB back it would increase the price of the service by a little over $3/month. Given that this is relatively insignificant we can ignore it but it was worthy of looking at with the simple monthly calculator.


Our next screen is the tags which we will not use but could be used to search if we have a large number of instances. The screen after that defines the open ports for this service. We want to add other ports like 1521 for the database, and 443 and 80 for application express. Port 1158 and 22 were predefined for us to allow for enterprise manager and ssh access.


At this point we are ready to launch our instance. We will have 50 GB of table space available and the database will be provisioned and ready for us upon completion.

Some things to note in the provisioning of this instance. We were never asked for an OID for the database. We were never asked for a password associated with the sys, system, or sysdba user account. We were never asked for a password to access the operating system instance. When we click on launch we are asked for an ssh key to access the instance once it is created.

When you launch the instance you see a splash screen then a detail screen as the instance is created. You also get an email confirming that you are provisioning an instance from the marketplace. At this point I notice that I provisioned Standard Edition and not Enterprise Edition. The experience is the same and nothing should change up to this point so we can continue with the SE AMI.



Once the instance is created we can look at the instance information and attach to the service via putty or ssh. The ip address that we were assigned was 54.242.14.146. We load the private key and ip address into putty and connect. We first failed with oracle then got an error message with root. Once we connect with ec2-user we are asked if we want to create a database, enter the OID, and enter the sys, system, and dbsnmp passwords.





The database creation takes a while (15-30 minutes according to the create script) and you get a percent complete notification as it progresses. At this point we have a database provisioned, the network configured, security through ssh keys to access the instance, and should be ready to connect to our database with sql developer. In our example it took over an hour to create the database after taking only five minutes to provision the operating system instance. The process stalled at 50% complete and sat there for a very long time. I also had to copy the /home/ec2-user/.ssh/authorized_keys into the /home/oracle/.ssh directory (after I created it) to allow the oracle user to login. The ec2-user account has rights to execute as root so you can create this directory, copy the file, and change ownership of the .ssh directory and contents to oracle. After you do this you can login as oracle and manage the database who owns the processes and directories in the /u01 directory.

It is important to note that the database in EC2 provides more features and functions than the Amazon RDS version of the database. Yes, you get automated backup with RDS but it is basically a snapshot to another storage cloud instance. With the EC2 instance you get features like spatial, multi-tenant, and sys access to the database. You also get the option to use RMAN for backups to directories that you can read offsite. You can setup DataGuard and Enterprise Manager. The EC2 feature set is significantly more robust but requires more work to setup and operate.

In summary, we looked at what it takes to provision a database onto Amazon EC2 using a pre-defined AMI. We also looked at the cost of doing this and found out that we can minimally do this at roughly $5.3K/month. When we add features that are typically desired this price grows to $8.8K/month. We first compared this to running DBaaS in a virtual instance in the Oracle Public Cloud at $6K/month (with a $3K/month smaller footprint available) and DBaaS as a service at $8K/month (with a $4K/month smaller footprint available). We talked about the optional packs and packages that are added with the High Performance option and talked about the benefits of PaaS vs IaaS. We did not get into patching, backups, and restart features provided with PaaS but did touch on them briefly when we went through our instance launch. We also compared this to the Amazon RDS instance in features and functions at about a hundred of dollars per month cheaper. The bulk of the cost is the database license and not the compute or storage configuration. It is important to note that the cost of the database perpetual license is still being paid for if you are running the service or not. With PaaS you do get the option of keeping the data active in cloud storage attached to a compute engine that is running but you can turn off the database license on an hourly or monthly basis to save money if this fits your usage model of a database service.

338 thoughts on “Database in Amazon EC2”

  1. I am only commenting to let you be aware of what a extraordinary discovery my cousin’s girl enjoyed browsing your webblog. She mastered such a lot of pieces, which include what it’s like to have a very effective helping mood to let folks without problems fully understand specified tricky issues. You actually exceeded her desires. Many thanks for supplying the beneficial, dependable, edifying and in addition cool tips about the topic to Evelyn.

  2. I definitely wanted to write down a small message so as to thank you for those lovely techniques you are placing here. My time intensive internet lookup has at the end been compensated with really good facts to exchange with my visitors. I would express that we readers are very blessed to be in a decent network with so many marvellous individuals with very helpful tricks. I feel quite happy to have encountered the web pages and look forward to tons of more thrilling minutes reading here. Thanks again for all the details.

  3. I have to show some thanks to the writer just for bailing me out of such a instance. Right after scouting throughout the world wide web and coming across notions which are not powerful, I assumed my life was gone. Existing minus the strategies to the difficulties you’ve fixed all through your good guide is a critical case, and those that would have in a wrong way damaged my career if I hadn’t discovered your web blog. Your primary competence and kindness in touching every aspect was precious. I don’t know what I would’ve done if I had not come across such a solution like this. I am able to at this point look ahead to my future. Thanks for your time so much for the specialized and result oriented guide. I will not think twice to refer the website to anyone who requires guidelines about this issue.

  4. Thank you for all of the work on this blog. Betty loves engaging in investigations and it’s really obvious why. Almost all learn all about the powerful method you convey helpful tips and hints through this web blog and as well as encourage contribution from some others about this topic then our own daughter is actually discovering a lot. Enjoy the remaining portion of the year. You’re doing a stunning job.

  5. My wife and i felt so delighted that Albert managed to conclude his preliminary research through the precious recommendations he grabbed from your own site. It is now and again perplexing to simply possibly be releasing key points which usually many others may have been trying to sell. Therefore we fully understand we need the blog owner to thank for this. Most of the illustrations you’ve made, the simple web site menu, the relationships your site aid to foster – it’s got many sensational, and it’s really letting our son in addition to us know that that concept is interesting, and that’s extremely mandatory. Many thanks for the whole lot!

  6. I simply wanted to appreciate you all over again. I am not sure the things that I would’ve carried out without the ideas provided by you concerning my industry. It actually was a horrifying circumstance in my position, but noticing a new expert technique you resolved it forced me to leap for joy. I’m just thankful for your assistance and in addition wish you realize what a powerful job you have been putting in teaching other individuals through your webpage. More than likely you haven’t encountered all of us.

  7. Needed to create you this tiny word to be able to say thank you again on the precious tricks you have featured in this case. This has been open-handed of you in giving openly what exactly a lot of people would’ve sold for an ebook to generate some money for their own end, mostly given that you could possibly have tried it if you ever desired. Those ideas as well worked like the easy way to realize that other individuals have the identical dream the same as my personal own to figure out significantly more with reference to this matter. I know there are a lot more fun sessions ahead for many who scan through your website.

  8. I not to mention my buddies have been checking out the excellent information and facts located on your web blog then unexpectedly developed a horrible feeling I never expressed respect to the blog owner for those secrets. The men were for that reason joyful to see all of them and have now clearly been enjoying those things. Many thanks for truly being well thoughtful as well as for finding some incredibly good things millions of individuals are really desperate to be aware of. Our sincere regret for not expressing gratitude to you earlier.

  9. I am just commenting to make you be aware of of the cool experience my friend’s daughter went through browsing yuor web blog. She realized too many details, including what it is like to have an excellent giving style to get the mediocre ones really easily thoroughly grasp certain tricky topics. You truly surpassed her expectations. I appreciate you for delivering those great, safe, revealing and in addition easy tips about the topic to Lizeth.

  10. I am commenting to make you know of the nice encounter my cousin’s child undergone studying your site. She came to find numerous things, which include what it’s like to possess a great teaching style to make many others with ease fully grasp selected tortuous subject areas. You undoubtedly surpassed visitors’ desires. I appreciate you for supplying those insightful, dependable, educational and in addition easy guidance on that topic to Ethel.

  11. Thank you so much for providing individuals with a very terrific opportunity to read critical reviews from this website. It is always so pleasurable and as well , packed with a lot of fun for me and my office fellow workers to visit your blog really 3 times in one week to learn the fresh items you have. And of course, I’m actually satisfied considering the mind-blowing ideas you serve. Selected 3 points on this page are ultimately the most effective we have ever had.

  12. I precisely wished to thank you so much all over again. I am not sure what I would have accomplished without the actual opinions shared by you on this problem. It had become a very frightful dilemma in my position, nevertheless seeing a new expert style you dealt with the issue took me to weep over joy. Extremely happier for your work and as well , hope you realize what an amazing job you are accomplishing educating the rest via your web site. Probably you have never come across all of us.

  13. I must point out my love for your kindness giving support to those people who should have guidance on this particular matter. Your real commitment to passing the solution up and down had become remarkably invaluable and has truly encouraged associates much like me to reach their desired goals. This informative facts means a whole lot a person like me and still more to my colleagues. Thanks a lot; from everyone of us.

  14. I want to express some thanks to you for bailing me out of such a difficulty. After surfing around through the the web and finding proposals which are not pleasant, I thought my entire life was well over. Being alive without the strategies to the difficulties you’ve resolved by means of your entire review is a crucial case, as well as ones that would have in a wrong way affected my entire career if I hadn’t noticed your web blog. Your own personal talents and kindness in maneuvering a lot of stuff was precious. I am not sure what I would have done if I had not discovered such a solution like this. I can at this time relish my future. Thanks for your time very much for this high quality and results-oriented guide. I won’t be reluctant to recommend the website to any individual who wants and needs care about this area.

  15. Thanks for all of the effort on this web page. Gloria enjoys getting into investigations and it’s easy to see why. We notice all of the dynamic way you make very important steps by means of the web blog and therefore boost participation from other people on that theme plus our own daughter is without a doubt becoming educated so much. Take advantage of the rest of the new year. You are always conducting a fabulous job.

Leave a Reply

Your email address will not be published. Required fields are marked *