Although you can use AWS RDS service which offers PaaS architectural model of running Oracle database on top of AWS Cloud, due to many limitations (installation type, options selected etc.), many enterprises still prefer using IaaS model, where such restrictions does not exist (e.g. you can install Enterprise Edition of Oracle database, RAC, Data Guard etc).

There is also security concerns as with PaaS model you have less control under your data when comparing it with IaaS or classical on-premises model.

For installing Oracle database on Amazon AWS you can use the following link as a starting point with a few comments/corrections you need to be aware of that I’ll explain later in the article:

From the Marketplace I’ve selected Oracle Linux 7 update 6 for x86_64 HVM – OL7.6-x86_64-HVM-2019-01-29 (ami-06e5c2a0f634abeb1) and t2.micro VM which comes with a free tier eligible option.

As t2.micro is equipped with limited resources (1Gb RAM, 1 vCPU) which is not enough to install Oracle Enterprise database, you need to create swap file:

#preallocate 1 Gb space for a swap file 
root@ip-address.ec2.internal:~> fallocate -l 1G /mnt/1GB.swap

#set correct permission
root@ip-address.ec2.internal:~> chmod 600 /mnt/1GB.swap

#set a file as Linux swap area
root@ip-address.ec2.internal:~> mkswap /mnt/1GB.swap

#Enable swap 
root@ip-address.ec2.internal:~> swapon /mnt/1GB.swap

#Verify the swap status
root@ip-address.ec2.internal:~>swapon --show
/mnt/1GB.swap file 1024M   0B   -2

To adjust swappines value from the default value of 60 to 10:

root@ip-address.ec2.internal:~> cat /proc/sys/vm/swappiness

you can execute the following command:

root@ip-address.ec2.internal:~> sysctl vm.swappiness=10

root@ip-address.ec2.internal:~> vim /etc/sysctl.conf 

This change is necessary if you want to avoid strange Oracle installation errors due to insufficient memory.

Next step is to download and install Oracle database preinstall rpm package to avoid manually installation of all required packages.

Here I’m providing correct link to the package for 19.3 version of Oracle database:

#downloading Oracle preinstallation package 
ec2-user@ip-address.ec2.internal:~> curl -o oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

#local installation of Oracle package 
root@ip-address.ec2.internal:/home/ec2-user> yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

On the following link you can find setup instructions to prepare your OS for the Oracle software installation:

You also need to disable Transparent HugePages (RHEL 6/7, OEL6/7) as that feature is incompatible with Oracle memory management where only static HugePages is allowed.

#check if Transparent Huge Pages feature is enabled:
root@ip-address.ec2.internal:/>cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never

#Check the name of default kernel 
root@ip-address.ec2.internal:/>grubby --default-kernel

#disable using Transparent Huge Pages on the next boot
root@ip-address.ec2.internal:/>grubby --args="transparent_hugepage=never" --update-kernel /boot/vmlinuz-0-rescue-08bcca960bd3419992b8a5f33698258c

#check if  transparent_hugepage is set to never
root@ip-address.ec2.internal:/>grubby --info /boot/vmlinuz-0-rescue-08bcca960bd3419992b8a5f33698258c
args="ro console=ttyS0,115200n8 console=tty0 net.ifnames=0 crashkernel=auto numa=off transparent_hugepage=never"
title=Oracle Linux Server (0-rescue-08bcca960bd3419992b8a5f33698258c with Linux) 7.7

The server must be rebooted for this to take effect, but before reboot, you should be aware that you might loose your data.

Data loss warning

To prevent data loss, before reboot you need to check if your instance is based on Instance store which is temporary block-level storage for an instance or EBS based permanent storage.

Check if instance is using EBS for a root volume

For more details of how to enable HugePages (and disabling Transparent Huge Pages), you can use the following link:

You may also need to allocate more space to your Volume as Oracle installation files for staging and after extraction takes a quite a bit of space.

To do that you need to install the following utility:

#installing cloud-utils-growpart utility
root@ip-ip-address.ec2.internal:/ >yum install cloud-utils-growpart

xvda    202:0    0  40G  0 disk 
└─xvda1 202:1    0  15G  0 part /

root@ip-ip-address.ec2.internal:/u01/app/oracle/product/>growpart /dev/xvda 1
CHANGED: partition=1 start=2048 old: size=31455232 end=31457280 new: size=83883999 end=83886047

root@ip-ip-address.ec2.internal:/u01/app/oracle/product/>mount | grep xvda
/dev/xvda1 on / type ext4 (rw,relatime,seclabel,data=ordered)

root@ip-ip-address.ec2.internal:/u01/app/oracle/product/>resize2fs /dev/xvda1 
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/xvda1 is mounted on /; on-line resizing required
old_desc_blocks = 2, new_desc_blocks = 5
The filesystem on /dev/xvda1 is now 10485499 blocks long.

Instead of using Dropbox, I uploaded Oracle installation binaries directly on the file system in AWS EC2 instance by using scp after which directories for Oracle installations should be created.

#upload Oracle database installation> scp -r -i "oracle-test.pem"

#create required directories
root@ip-address.ec2.internal:/>chown -R oracle:oinstall u01/

oracle@ip-address.ec2.internal:~>mkdir -p /u01/app/oracle/product/
oracle@ip-address.ec2.internal:~>mkdir -p /u01/oradata
oracle@ip-address.ec2.internal:~>mkdir -p /u01/software

Additionally, for installing Oracle database I’m not using response file, but GUI (X11 forwarding) instead (easier to debug), as Oracle installation is not something you want to perform every day.

#exporting a display after you setup X11 forwarding and authentifications
export DISPLAY=localhost:10

#starting Oracle installation

Finally you can start the installation (here I’m not going to show every step  like unpacking files, changing permissions etc., just those that differ from the regular installation).

#exporting a display after you setup X11 forwarding and authentifications
export DISPLAY=localhost:10

#starting Oracle installation

After the installation is completed, to start Oracle database, you need to use ssh to connect to AWS cloud.

Assuming you have already downloaded private key file from EC2, and you switch from ec2-user to oracle, you should execute the following steps:

oracle@ip-172-31-33-192.ec2.internal:~>. oraset 
1) orcl
SID? 1

where “oraset” is my script that setup the following environment variables:

export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/
export TNS_ADMIN=/u01/app/oracle/product/


oracle@ip-address.ec2.internal:~>lsnrctl start
oracle@ip-address .ec2.internal:~>sqlp
SQL*Plus: Release Production on Mon Oct 7 09:47:36 2019
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to an idle instance.

SYS@orcl> startup
ORACLE instance started.

Total System Global Area  536870912 bytes
Fixed Size		    8622776 bytes
Variable Size		  293604680 bytes
Database Buffers	  230686720 bytes
Redo Buffers		    3956736 bytes
Database mounted.
Database opened.

SYS@orcl> alter system register;	

To connect to your first AWS Cloud Oracle instance, you need to create ssh tunnel.

Normally, you should setup ssh connection type and local port forward in SQL Developer.

How to do that you can find on the following link:

On my Linux laptop, SQL Developer ssh connection doesn’t work properly (probably bug in SQL Developer), which is a reason why I need to manually create ssh tunnel and to setup port forwarding in one shot by executing the following command: > ssh -i oracle-private_key.pem -L

Last login: Mon Oct  7 09:47:15 2019 from

After that I need to setup connection in SQL Developer that might look like one in the following figure:

SQL Developer connection setup for AWS

Last step is to connect and test if everything is working as expected.

Check if connection is working as expected


Having your Oracle database in a AWS Cloud might be beneficial for you to understand Cloud computing and Oracle behavior in the Cloud.

AWS is selected only because it is the most popular widely used Cloud vendor at the moment, but you can use similar steps with other major Cloud vendors.

Get notified when a new post is published!



There are no comments yet. Why not start the discussion?

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.