Setting up your environment for Amazon RDS Custom for Oracle - Amazon Relational Database Service

Setting up your environment for Amazon RDS Custom for Oracle

Before you create a DB instance based on Amazon RDS Custom for Oracle, perform the following tasks.

Prerequisites for creating an RDS Custom for Oracle instance

Before creating an RDS Custom for Oracle DB instance, make sure that you meet the following prerequisites:

For each task, the following sections describe the requirements and limitations specific to the task. For example, when you create your RDS Custom DB for Oracle instance, use either the db.m5 or db.r5 instance classes running Oracle Linux 7 Update 6. For general requirements that apply to RDS Custom, see Requirements and limitations for Amazon RDS Custom.

Make sure that you have a symmetric AWS KMS key

A symmetric AWS KMS key is required for RDS Custom. When you create an RDS Custom DB instance, you supply the KMS key identifier. For more information, see Creating and connecting to a DB instance for Amazon RDS Custom for Oracle.

You have the following options:

  • If you have an existing symmetric KMS key in your account, you can use it with RDS Custom. No further action is necessary.

  • If you don't already have a symmetric KMS key in your account, create one by following the instructions in Creating keys in the AWS Key Management Service Developer Guide.

You can choose the same symmetric key when you create a CEV and a DB instance, or choose different keys. RDS Custom doesn't support AWS-managed KMS keys.

The symmetric key you wish to use must provide the IAM role in your IAM instance profile for RDS Custom with access to the kms:Decrypt and kms:GenerateDataKey operations. If you have created a new symmetric key in your account, no changes are required. Otherwise, make sure that your symmetric key's policy can provide access to these operations.

For more information on configuring IAM for RDS Custom for Oracle, see Configuring IAM and your VPC.

Download and install the AWS CLI

AWS provides you with a command-line interface to use RDS Custom features. You can use either version 1 or version 2 of the AWS CLI.

For information on downloading and installing the AWS CLI, see Installing or updating the latest version of the AWS CLI.

If you plan to access RDS Custom only from the AWS Management Console, skip this step.

If you have already downloaded the AWS CLI for Amazon RDS or RDS Custom for SQL Server, skip this step.

Configuring IAM and your VPC

You can configure your IAM role and virtual private cloud (VPC) using either of the following techniques:

Configuring IAM and your VPC using AWS CloudFormation

To simplify setup, you can use the AWS CloudFormation template files to create CloudFormation stacks. To learn how to create stacks, see Creating a stack on the AWS CloudFormation console in AWS CloudFormation User Guide.

To download the template files

  1. Open the context (right-click) menu for the link custom-oracle-iam.json and choose Save Link As.

  2. Save the file to your computer.

  3. Repeat the previous steps for the link custom-vpc.json.

    If you already configured your VPC for RDS Custom for SQL Server, skip this step.

To configure IAM using CloudFormation

  1. Open the CloudFormation console at https://console.aws.amazon.com/cloudformation.

  2. Start the Create Stack wizard, and choose Create Stack.

  3. On the Specify template page, do the following:

    1. For Template source, choose Upload a template file.

    2. For Choose file, navigate to, then choose custom-oracle-iam.json.

    3. Choose Next.

  4. On the Specify stack details page, do the following:

    1. For Stack name, enter custom-oracle-iam.

    2. Choose Next.

  5. On the Configure stack options page, choose Next.

  6. On the Review custom-oracle-iam page, do the following:

    1. For Capabilities, select the I acknowledge that AWS CloudFormation might create IAM resources with custom names check box.

    2. Choose Create stack.

    CloudFormation creates the IAM roles that RDS Custom for Oracle requires.

To configure your VPC using CloudFormation

This procedure assumes that you've already used CloudFormation to create your IAM roles.

If you've already configured your VPC for RDS Custom for SQL Server, you can skip this step.

  1. Open the CloudFormation console at https://console.aws.amazon.com/cloudformation.

  2. On the Stacks page, for Create stack choose With new resources (standard).

  3. On the Specify template page, do the following:

    1. For Template source, choose Upload a template file.

    2. For Choose file, go to and choose custom-vpc.json.

    3. Choose Next.

  4. On the Specify stack details page, do the following:

    1. For Stack name, enter custom-vpc.

    2. For Parameters, choose the private subnets to use for RDS Custom DB instances.

    3. Choose the private VPC ID to use for RDS Custom DB instances.

    4. Enter the route table associated with the private subnets.

    5. Choose Next.

  5. On the Configure stack options page, choose Next.

  6. On the Review custom-vpc page, choose Create stack.

    CloudFormation configures your VPC.

Creating your IAM role and instance profile manually

To use RDS Custom, you create an IAM instance profile named AWSRDSCustomInstanceProfileForRdsCustomInstance. You also create the IAM role AWSRDSCustomInstanceRoleForRdsCustomInstance for the instance profile. You then add AWSRDSCustomInstanceRoleForRdsCustomInstance to your instance profile.

The following section explains how to perform the task without using CloudFormation.

To create the RDS Custom instance profile and add the necessary role to it

  1. Create the IAM role named AWSRDSCustomInstanceRoleForRdsCustomInstance with a trust policy that Amazon EC2 can use to assume this role.

  2. Add an access policy to AWSRDSCustomInstanceRoleForRdsCustomInstance.

  3. Create an IAM instance profile for RDS Custom named AWSRDSCustomInstanceProfileForRdsCustomInstance.

  4. Add the AWSRDSCustomInstanceRoleForRdsCustomInstance IAM role to the instance profile.

Create the role AWSRDSCustomInstanceRoleForRdsCustomInstance

The following example creates the role AWSRDSCustomInstanceRoleForRdsCustomInstance. Using the trust policy, Amazon EC2 can assume the role.

aws iam create-role \ --role-name AWSRDSCustomInstanceRoleForRdsCustomInstance \ --assume-role-policy-document '{ "Version": "2012-10-17", "Statement": [ { "Action": "sts:AssumeRole", "Effect": "Allow", "Principal": { "Service": "ec2.amazonaws.com" } } ] }'

Add an access policy to AWSRDSCustomInstanceRoleForRdsCustomInstance

When you embed an inline policy in an IAM role, the inline policy is used as part of the role's access (permissions) policy. You create the AWSRDSCustomIamRolePolicy policy that permits Amazon EC2 to send and receive messages and perform various actions.

The following example creates the access policy named AWSRDSCustomIamRolePolicy, and adds it to the IAM role AWSRDSCustomInstanceRoleForRdsCustomInstance. This example assumes that you have set the $REGION and $ACCOUNT_ID variables in the AWS CLI. This example also requires the Amazon Resource Name (ARN) of the AWS KMS key that you want to use for your RDS Custom DB instances.

To specify more than one KMS key, add it to the Resources section of statement ID (Sid) 11.

aws iam put-role-policy \ --role-name AWSRDSCustomInstanceRoleForRdsCustomInstance \ --policy-name AWSRDSCustomIamRolePolicy \ --policy-document '{ "Version": "2012-10-17", "Statement": [ { "Sid": "1", "Effect": "Allow", "Action": [ "ssm:DescribeAssociation", "ssm:GetDeployablePatchSnapshotForInstance", "ssm:GetDocument", "ssm:DescribeDocument", "ssm:GetManifest", "ssm:GetParameter", "ssm:GetParameters", "ssm:ListAssociations", "ssm:ListInstanceAssociations", "ssm:PutInventory", "ssm:PutComplianceItems", "ssm:PutConfigurePackageResult", "ssm:UpdateAssociationStatus", "ssm:UpdateInstanceAssociationStatus", "ssm:UpdateInstanceInformation", "ssm:GetConnectionStatus", "ssm:DescribeInstanceInformation", "ssmmessages:CreateControlChannel", "ssmmessages:CreateDataChannel", "ssmmessages:OpenControlChannel", "ssmmessages:OpenDataChannel" ], "Resource": [ "*" ] }, { "Sid": "2", "Effect": "Allow", "Action": [ "ec2messages:AcknowledgeMessage", "ec2messages:DeleteMessage", "ec2messages:FailMessage", "ec2messages:GetEndpoint", "ec2messages:GetMessages", "ec2messages:SendReply" ], "Resource": [ "*" ] }, { "Sid": "3", "Effect": "Allow", "Action": [ "logs:PutRetentionPolicy", "logs:PutLogEvents", "logs:DescribeLogStreams", "logs:DescribeLogGroups", "logs:CreateLogStream", "logs:CreateLogGroup" ], "Resource": [ "arn:aws:logs:'$REGION':*:log-group:rds-custom-instance*" ] }, { "Sid": "4", "Effect": "Allow", "Action": [ "s3:putObject", "s3:getObject", "s3:getObjectVersion" ], "Resource": [ "arn:aws:s3:::do-not-delete-rds-custom-*/*" ] }, { "Sid": "5", "Effect": "Allow", "Action": [ "cloudwatch:PutMetricData" ], "Resource": [ "*" ], "Condition": { "StringEquals": { "cloudwatch:namespace": [ "RDSCustomForOracle/Agent" ] } } }, { "Sid": "6", "Effect": "Allow", "Action": [ "events:PutEvents" ], "Resource": [ "*" ] }, { "Sid": "7", "Effect": "Allow", "Action": [ "secretsmanager:GetSecretValue", "secretsmanager:DescribeSecret" ], "Resource": [ "arn:aws:secretsmanager:'$REGION':'$ACCOUNT_ID':secret:do-not-delete-rds-custom-*" ] }, { "Sid": "8", "Effect": "Allow", "Action": [ "s3:ListBucketVersions" ], "Resource": [ "arn:aws:s3:::do-not-delete-rds-custom-*" ] }, { "Sid": "9", "Effect": "Allow", "Action": "ec2:CreateSnapshots", "Resource": [ "arn:aws:ec2:*:*:instance/*", "arn:aws:ec2:*:*:volume/*" ], "Condition": { "StringEquals": { "ec2:ResourceTag/AWSRDSCustom": "custom-oracle" } } }, { "Sid": "10", "Effect": "Allow", "Action": "ec2:CreateSnapshots", "Resource": [ "arn:aws:ec2:*::snapshot/*" ] }, { "Sid": "11", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": [ "arn:aws:kms:'$REGION':'$ACCOUNT_ID':key/abcd1234-5678-eeff-9012-123456abcdef" ] }, { "Sid": "12", "Effect": "Allow", "Action": "ec2:CreateTags", "Resource": "*", "Condition": { "StringLike": { "ec2:CreateAction": [ "CreateSnapshots" ] } } } ] }'

Create your RDS Custom instance profile

Create your IAM instance profile as follows, naming it AWSRDSCustomInstanceProfileForRdsCustomInstance.

aws iam create-instance-profile \ --instance-profile-name AWSRDSCustomInstanceProfileForRdsCustomInstance

Add AWSRDSCustomInstanceRoleForRdsCustomInstance to your RDS Custom instance profile

Add the IAM role AWSRDSCustomInstanceRoleForRdsCustomInstance to the profile AWSRDSCustomInstanceProfileForRdsCustomInstance.

aws iam add-role-to-instance-profile \ --instance-profile-name AWSRDSCustomInstanceProfileForRdsCustomInstance \ --role-name AWSRDSCustomInstanceRoleForRdsCustomInstance

Configuring your VPC manually

Your RDS Custom DB instance is in a VPC, just like an Amazon EC2 instance or Amazon RDS instance. You provide and configure your own VPC. Thus, you have full control over your instance networking setup.

RDS Custom sends communication from your DB instance to other AWS services. To make sure that RDS Custom can communicate, it validates network connectivity to these services.

If you have already configured a VPC for RDS Custom for SQL Server, you can reuse that VPC and skip this process.

Configure your instance security group

A security group acts as a virtual firewall for a VPC instance, controlling both inbound and outbound traffic. An RDS Custom DB instance has a default security group that protects the instance. Make sure that your security group permits traffic between RDS Custom and other AWS services.

To configure your security group for RDS Custom

  1. Sign in to the AWS Management Console and open the Amazon VPC console at https://console.aws.amazon.com/vpc.

  2. Allow RDS Custom to use the default security group, or create your own security group. For detailed instructions, see Provide access to your DB instance in your VPC by creating a security group.

  3. If you have a private VPC and use VPC endpoints, make sure that your security group permits outbound connections on port 443. RDS Custom needs this port to communicate with dependent AWS services.

For more information about security groups, see Security groups for your VPC in Amazon VPC Developer Guide.

Configure endpoints for dependent AWS services

Make sure that your VPC allows outbound traffic to the following AWS services:

  • Amazon CloudWatch

  • Amazon CloudWatch Logs

  • Amazon CloudWatch Events

  • Amazon EC2

  • Amazon EventBridge

  • Amazon S3

  • AWS Secrets Manager

  • AWS Systems Manager

We recommend that you add endpoints for every service to your VPC using the following instructions. However, you can use any solution that makes it possible for your VPC to communicate with AWS service endpoints. For example, you can use Network Address Translation (NAT) or AWS Direct Connect.

To configure endpoints for AWS services with which RDS Custom works

  1. Open the Amazon VPC console at https://console.aws.amazon.com/vpc/.

  2. On the navigation bar, use the Region selector to choose the AWS Region.

  3. In the navigation pane, choose Endpoints. In the main pane, choose Create Endpoint.

  4. For Service category, choose AWS services.

  5. For Service Name, choose the endpoint shown in the table.

  6. For VPC, choose your VPC.

  7. For Subnets, choose a subnet from each Availability Zone to include.

    The VPC endpoint can span multiple Availability Zones. AWS creates an elastic network interface for the VPC endpoint in each subnet that you choose. Each network interface has a Domain Name System (DNS) host name and a private IP address.

  8. For Security group, choose or create a security group.

    You can use security groups to control access to your endpoint, much as you use a firewall.

  9. Choose Create endpoint.

The following table explains how to find the list of endpoints that your VPC needs to use for outbound communications.

Service Endpoint format Notes and links

AWS Systems Manager

Use the endpoint format ssm.region.amazonaws.com.

For the list of endpoints in each Region, see AWS Systems Manager endpoints and quotas in the Amazon Web Services General Reference.

AWS Secrets Manager

Use the endpoint format secretsmanager.region.amazonaws.com.

For the list of endpoints in each Region, see AWS Secrets Manager endpoints and quotas in the Amazon Web Services General Reference.

Amazon CloudWatch

Use the following endpoint formats:

  • For CloudWatch metrics, use monitoring.region.amazonaws.com

  • For CloudWatch Events, use events.region.amazonaws.com

  • For CloudWatch Logs, use logs.region.amazonaws.com

For the list of endpoints in every Region, see the following:

Amazon S3

Use the endpoint format s3.region.amazonaws.com.

For the list of endpoints in each Region, see Amazon Simple Storage Service endpoints and quotas in the Amazon Web Services General Reference.

To learn more about gateway endpoints for Amazon S3, see Endpoints for Amazon S3 in the Amazon VPC Developer Guide.

To learn how to create an access point, see Creating an Amazon S3 access point in the Amazon VPC Developer Guide.

Configure the instance metadata service

Make sure that your instance can do the following:

  • Access the instance metadata service using Instance Metadata Service Version 2 (IMDSv2).

  • Allow outbound communications through port 80 (HTTP) to the IMDS link IP address.

  • Request instance metadata from http://169.254.169.254, the IMDSv2 link.

For more information on IMDSv2, see Use IMDSv2 in the Amazon EC2 User Guide for Linux Instances.

RDS Custom for Oracle automation uses IMDSv2 by default, by setting HttpTokens=enabled on the underlying Amazon EC2 instance. However, you can use IMDSv1 if you want. For more information, see Configure the instance metadata options in the Amazon EC2 User Guide for Linux Instances.

Grant required permissions to your IAM user

The IAM principal that creates the CEV must have either of the following policies:

  • The AdministratorAccess policy

  • The AmazonRDSFullAccess policy with the following additional permissions.

    iam:SimulatePrincipalPolicy cloudtrail:CreateTrail cloudtrail:StartLogging s3:CreateBucket s3:PutBucketPolicy mediaimport:CreateDatabaseBinarySnapshot