IAM Authentication for AWS RDS¶
This support is available from Privacera Release 9.0.2.2/9.0.4.1 onwards.
This guide provides step-by-step instructions to enable IAM authentication for RDS. IAM authentication allows you to use AWS Identity and Access Management (IAM) roles to manage database access. This feature provides a secure way to connect to your RDS database without the need to manage database credentials.
There are four Access Management services that use databases.
Service | Supported | Optional |
---|---|---|
Privacera Portal | Yes | No |
Apache Ranger Admin | Yes | No |
Privacera Ops Server | Yes | Yes |
Privacera Scheme Server | Yes | Yes |
The Discovery module is not supported with IAM authentication.
AWS RDS supports multiple database engines, and Privacera provides a compatibility matrix.
For more details Click here
Engine | Version | Supported |
---|---|---|
Aurora PostgreSQL | 16.1 | Yes |
Prerequisites¶
Prerequisite | Description |
---|---|
AWS RDS Database | An existing RDS database cluster or the ability to create a new one. |
AWS Management Console Access | Access to the AWS Management Console. This is optional if you will be automating the setup |
IAM User | IAM user with privileges to modify RDS and create roles/policies. |
Note
This guide uses AWS Management Console for the setup. You can also use the AWS CLI or SDK to automate the setup. Please note these steps are for reference only. Please refer to the AWS documentation for the latest instructions.
Setup¶
Step 1: Create or Modify an RDS Cluster¶
- Go to the AWS Management Console.
- Navigate to RDS:
- Select Create Database or an Existing Database.
- Modify Database Settings:
- Click on Modify.
- Under Database Authentication, ensure that IAM database authentication is enabled.
- Save Changes.
Step 2: Grant Permissions on the Database¶
Once IAM authentication is enabled, grant the rds_iam
role to the database user.
- Connect to the database: Use the master username and password to connect via a SQL client such as DBeaver, MySQL Workbench, psql, or AWS RDS Query Editor.
- Grant IAM Access (for PostgreSQL):
Tip
- Use
privacera
as the database user. If you are using a different user, then please consult Privacera's support. Also subsequent steps will need to be adjusted accordingly. - The
rds_iam
role is a predefined role that allows IAM authentication.
Step 3: Create the Privacera Database (privacera_db
)¶
-
Create Database for Privacer: Use the same SQL client to run the following commands to create the Privacera database and assign privileges:
-
Verify Permissions: Connect to
privacera_db
and run the query below to verify the granted privileges:
privacera
in the format mentioned. grantee | schema | usage_privilege | create_privilege |
---|---|---|---|
privacera | public | USAGE | CREATE |
Step 4: Create an IAM Role and Policy for RDS¶
Create IAM Policy¶
- Navigate to IAM → Policies → Create Policy.
-
Click on the JSON tab and paste the following policy snippet:
JSON Tip
- Replace
<region>
,<account-id>
, and<db-cluster-id>
with your AWS region, account ID, and Regional cluster resource ID respectively. - The
rds-db:connect
action allows the IAM role to connect to the RDS database. - The database user is
privacera
as per the previous steps. Update the name if you are using a different user.
- Replace
-
Click Next and save the policy with the name
privacera-rds-policy
and a description likePrivacera RDS Policy
. - Click on Create Policy.
Create Role for the policy¶
- Navigate to IAM → Roles → Create Role.
- Select Trusted entity and choose Web identity.
- Enter Details:
- Identity provider: Select OIDC provider.
- Audience:
sts.amazonaws.com
- Add Condition:
- Key: Select OIDC provider.
- Condition:
StringLike
- Value:
system:serviceaccount:*privacera-sa
- Click Next.
- Attach Policy:
- Enter in the search box:
privacera-rds-policy
.
- Enter in the search box:
- Click Next.
- Enter Role Details:
- Role Name:
privacera-rds-role
- Description: This role is used by Privacera to connect to RDS.
- Role Name:
- Click Create Role.
Step 5: Changes for Privacera-Manager¶
Changes for External DB¶
- Open Terminal and SSH to the instance where Privacera-Manager is installed.
-
Create external DB variables in the custom-config and update properties.
Bash - Update the following variables:
- Replace:YAML Tip
REGION
- AWS region where the RDS is located.EXTERNAL_DB_HOST
- Endpoint URL of the RDS Postgres.EXTERNAL_DB_NAME
- If you have created a different database, update the name here.EXTERNAL_DB_USER
- If you have created a different user, update the name here.
Changes for Portal¶
- Update variables for the service Portal.
-
Copy vars to custom-config if they are not present.
-
Update the following variables:
YAML Tip
Replace: -
ROLE_ARN
- Copy the Role ARN created in the previous section. E.g.arn:aws:iam::123456789012:role/privacera-rds-role
Changes for Ranger¶
- Update Ranger variables in the custom-config.
-
Copy vars to custom-config if they are not present.
Bash YAML Tip
Replace: -
ROLE_ARN
- Copy the Role ARN created in the previous section. E.g.arn:aws:iam::123456789012:role/privacera-rds-role
Changes for Ops Server¶
- Update Ops-server variables in the custom-config.
-
Copy vars to custom-config if they are not present.
-
Update the following variables:
YAML Tip
Replace: -
ROLE_ARN
- Copy the Role ARN created in the previous section. E.g.arn:aws:iam::123456789012:role/privacera-rds-role
Changes for Scheme Server¶
- Update Scheme-server variables in the custom-config.
-
Copy vars to custom-config if they are not present.
-
Update the following variables:
YAML Tip
Replace: -
ROLE_ARN
- Copy the Role ARN created in the previous section. E.g.arn:aws:iam::123456789012:role/privacera-rds-role
Step 6: Apply Changes¶
If you haven't completed the base installation setup, you can skip this step and continue with the base installation steps.
Step 1 - Setup which generates the helm charts. This step usually takes few minutes.
Step 2 - Apply the Privacera Manager helm charts. Step 3 - Post-installation step which generates Plugin tar ball, updates Route 53 DNS and so on.