Securely connecting on-premises knowledge techniques to Amazon Redshift requires eradicating static credentials whereas preserving seamless entry to your knowledge groups. This answer extends connectivity out of your on-premises knowledge facilities to Amazon Redshift through the use of short-lived, auditable credentials. All site visitors stays inside trusted, personal channels.
Builders and knowledge engineers want a course of to run ingestion pipelines, Extract, Rework, Load (ETL) jobs, and analytics queries with out managing static credentials or complicated authentication flows. You need to use AWS Id and Entry Administration (IAM) Roles Wherever to acquire non permanent safety credentials in IAM. This service extends the short-term credential mannequin of AWS past the cloud and permits on-premises workloads to authenticate with IAM utilizing X.509 certificates from an current certificates authority. This strategy removes static IAM entry keys and applies least-privilege entry via IAM insurance policies. Each request is recorded in AWS CloudTrail. Paired with personal Area Identify System (DNS) and Amazon Digital Non-public Cloud (Amazon VPC) endpoints for Amazon Redshift, it retains authentication and knowledge flows inside personal networks with out traversing the general public web.
On this submit, you’ll learn to use AWS IAM Roles Wherever with Amazon Redshift for safe, personal connections. This removes the necessity to expose site visitors to the general public web or handle long-lived entry keys.
The problem
Organizations connecting on-premises knowledge techniques to Amazon Redshift sometimes select from a number of established safety patterns, every with tradeoffs in threat, complexity, and operational overhead. Static IAM entry keys are easy to undertake however require ongoing rotation, safe distribution, and storage throughout techniques. Their long-lived nature will increase the affect of unintentional publicity in code, configuration recordsdata, or logs. Shared database or service credentials can streamline setup however usually cut back auditability, weaken least-privilege controls, and create accountability challenges throughout groups. VPN or personal community connections enhance community isolation, but they nonetheless require robust application-layer authentication and add infrastructure administration burdens. Customized secret-management or credential-brokering options can cut back reliance on long-lived credentials, however they introduce extra elements that should be constructed, built-in, and maintained. As organizations scale, these patterns usually power tradeoffs between robust safety controls and the developer productiveness wanted to construct and function knowledge pipelines effectively.
Resolution overview
The answer integrates on-premises workloads with Amazon Redshift utilizing IAM Roles Wherever and the built-in IAM authentication of Amazon Redshift. The core thought is that on-premises workloads use X.509 certificates to acquire short-term IAM credentials, then alternate them for non permanent Amazon Redshift database credentials. Each provisioned clusters and serverless workgroups are supported. The structure consists of those primary elements:
- Amazon Redshift Service Endpoint – Handles safe API calls reminiscent of GetClusterCredentials, GetCredentials, and GetClusterCredentialsWithIAM. The on-premises workload makes use of these API endpoints to request non permanent database credentials.
- Amazon Redshift Cluster Endpoint – Offers the connection level for database operations on provisioned Amazon Redshift clusters. After acquiring non permanent credentials, purposes and instruments like JDBC/ODBC drivers or psql connect with the cluster endpoint. They use this connection to execute SQL queries, load knowledge, and carry out analytics duties.
- Amazon Redshift Serverless Workgroup Endpoint – Serves the identical perform because the cluster endpoint however for serverless deployments. After non permanent credentials are retrieved via the GetCredentials API, purposes connect with this endpoint utilizing normal database drivers (JDBC/ODBC) or command line instruments like psql to run queries and cargo knowledge.
- Certificates authority – For this submit, we use AWS Non-public Certificates Authority (AWS Non-public CA) because the certificates authority (CA) supply. Alternatively, you’ll be able to combine with an exterior CA. For extra particulars, see IAM Roles Wherever with an exterior certificates authority.
- X.509 Certificates – We use a pattern personal certificates saved in AWS Certificates Supervisor (ACM) and issued by AWS Non-public CA.
- IAM Roles Wherever – Points short-term AWS credentials to on-premises processes primarily based on X.509 certificates from a corporation’s certificates authority. These non permanent credentials enable the workload to imagine an IAM function that grants entry to Amazon Redshift APIs.
To retrieve non permanent credentials utilizing IAM Function Wherever, we use the credential_process parameter in AWS Command Line Interface (AWS CLI) profile configurations to set off an exterior course of that generates or retrieves credentials. This submit makes use of X.509 certificates to authenticate and return non permanent IAM credentials via IAM Roles Wherever. The AWS IAM Roles Wherever Credential Helper is executed to deal with the signing course of for the CreateSession API, returning credentials in a JSON format that purposes and instruments can eat.
Amazon Redshift supplies a number of APIs that work collectively to help non permanent, IAM-based authentication for various deployment eventualities. When connecting to a provisioned Amazon Redshift cluster, purposes sometimes use the GetClusterCredentials API, which returns short-term database credentials tied to an IAM function’s permissions. For organizations with absolutely IAM-managed identities, GetClusterCredentialsWithIAM streamlines this course of by robotically mapping the IAM identification to a database consumer, eradicating the necessity to specify usernames manually. In serverless deployments, the GetCredentials API performs the identical perform, issuing non permanent credentials for Amazon Redshift Serverless workgroups primarily based on IAM permissions. Collectively, these APIs preserve static credentials from being saved or distributed whereas providing versatile integration paths for each provisioned and serverless Amazon Redshift architectures.
Stream overview
An on-premises ETL job begins by initiating a request and authenticates with AWS utilizing IAM Roles Wherever to imagine an IAM function securely. After acquiring non permanent safety credentials, the workload calls the Amazon Redshift service endpoint to execute the GetClusterCredentials API, which returns short-term database credentials. These credentials enable the workload to connect with the Amazon Redshift cluster endpoint via a VPC endpoint. This permits working SQL queries or loading knowledge into the cluster as a part of the ETL course of.

Conditions
You will need to have the next stipulations to observe together with this submit.
AWS account necessities
- An AWS account with permissions to deploy AWS CloudFormation templates.
- Entry to AWS CloudShell for exporting a pattern personal certificates that we create utilizing AWS CloudFormation in a later step.
Distant surroundings
Community Connectivity necessities
Deploy AWS sources with AWS CloudFormation
- Navigate to the AWS CloudFormation console.
- Select Create Stack.
- Obtain the redshift-iamra-template template.
- For Specify template, select Add a template file and add redshift-iamra-template.
- Select Subsequent.
- Enter a novel title for Stack title. The default worth is
redshift-test. - Configure the stack parameters. The next desk supplies default values.
| Parameter title | Default worth | Description |
VPCCIDR | 10.0.0.0/16 | CIDR block for the VPC |
PrivateSubnet1CIDR | 10.0.1.0/24 | CIDR block for the primary personal subnet |
PrivateSubnet2CIDR | 10.0.2.0/24 | CIDR block for the second personal subnet |
CACommonName | redshift-ca.instance.com | Frequent Identify for the Certificates |
CAOrganization | Instance Corp | Group for the Certificates Authority |
CACountry | US | Nation for the Certificates Authority |
CAValidityInDays | 1826 | Validity interval in days for the CA Certificates (5 years) |
RedshiftClusterIdentifier | my-redshift-cluster | Identifier for the Amazon Redshift cluster |
RedshiftDatabaseName | dev | Identify of the preliminary database within the Amazon Redshift cluster |
RedshiftMasterUsername | admin | Fundamental username for the Amazon Redshift cluster |
RedshiftNodeType | ra3.xlplus | Node kind for the Amazon Redshift cluster |
ServerlessNamespace | my-serverless-namespace | Namespace identifier for Amazon Redshift Serverless |
ServerlessWorkgroup | my-serverless-workgroup | Workgroup identifier for Amazon Redshift Serverless |
- Choose the acknowledgement checkbox and select Create Stack. Stack deployment takes about 10 minutes to finish.
- When stack creation is full, navigate to the Outputs tab on the AWS CloudFormation console and notice down the values for the sources that the stack created.
The next desk reveals a summarized view of the output values.
| Output | Description | Instance worth |
CertificateAuthorityArn | Amazon Useful resource Identify (ARN) of the Non-public Certificates Authority | arn:aws:acm-pca:aa-example-1:111122223333:certificate-authority/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222 |
ClientCertificateArn | ARN of the pattern shopper certificates | arn:aws:acm:aa-example-1:111122223333:certificates/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 |
ProfileArn | ARN of the IAM Roles Wherever profile | arn:aws:rolesanywhere:aa-example-1:111122223333:profile/a1b2c3d4-5678-90ab-cdef-EXAMPLE44444 |
RedshiftAccessRoleArn | ARN of the Amazon Redshift Entry function | arn:aws:iam::1222345677:function/Redshift-test-RedshiftAccessRole |
TrustAnchorArn | ARN of the IAM Roles Wherever profile. You’ll use this worth for configuring credential_process for IAM Roles Wherever in a later step. | arn:aws:rolesanywhere:aa-example-1:111122223333:trust-anchor/a1b2c3d4-5678-90ab-cdef-EXAMPLE33333 |
RedshiftClusterEndpoint | Non-public endpoint of the Amazon Redshift Cluster | my-redshift-cluster-123456789012.aa-example-1.redshift.amazonaws.com |
RedshiftClusterPort | Port of the Amazon Redshift Cluster | 5439 |
ServerlessWorkgroupEndpoint | Non-public endpoint of Amazon Redshift Serverless Workgroup | my-serverless-workgroup-123456789012.aa-example-1.redshift.serverless.amazonaws.com |
Export a pattern personal certificates utilizing CloudShell
To export a pattern personal certificates utilizing CloudShell, full the next steps.
- Open CloudShell. For extra particulars, see Navigating the AWS CloudShell interface.
- Export the certificates ARN from the CloudFormation outputs. If you happen to modified the stack title within the earlier step, use that worth for
<stack-name>. In any other case, use the default worthredshift-public-iam-roles-anywhere.
- Extract the certificates and personal key recordsdata:
- Obtain the extracted certificates and personal key recordsdata from CloudShell:
- Safe the personal key in your native workstation.
After downloading the recordsdata, prohibit file permissions to forestall unauthorized entry:
chmod 400 private_key.pemchmod 400 certificates.pem
For manufacturing workloads, contemplate storing personal keys in your working system’s keychain (macOS Keychain, Home windows Certificates Retailer), a {hardware} safety module (HSM), or a secrets and techniques administration instrument slightly than as recordsdata on disk.
Configure an AWS CLI profile
These are the steps to configure an AWS CLI profile in your system:
- Retailer the downloaded certificates and personal key to your surroundings. For an automatic strategy to generate and rotate certificates, see Arrange AWS Non-public Certificates Authority to difficulty certificates to be used with IAM Roles Wherever.
- Create a brand new profile named
onprem-redshift. This invokes the credential course of. Exchange the placeholders together with your particular values. Discover the values fortrusted-anchor-arn,profile-arn, androle-arnin your CloudFormation stack outputs.
- Confirm your configuration. Open the
~/.aws/configfile and make sure that it accommodates a profile.
Take a look at the answer
Observe these steps to validate your setup for provisioned clusters to verify end-to-end connectivity:
- Confirm community connectivity
Earlier than testing authentication, verify that your on-premises surroundings can attain the Amazon Redshift cluster endpoint:
telnet my-redshift-cluster.abc123.us-east-1.redshift.amazonaws.com 5439
If the connection succeeds, you must see a response indicating the port is open. If it fails, confirm your VPN/Direct Join configuration and safety group guidelines.
- Create database consumer
If you happen to haven’t already created a consumer, connect with your Amazon Redshift as the principle consumer and create a devoted consumer for testing:
CREATE USER analytics_user PASSWORD '[PASSWORD]';
- Retrieve Amazon Redshift database credentials
With the configuration in place, request non permanent database credentials from Amazon Redshift:
This name returns a short-lived username and password that’s legitimate for connecting to the cluster. By default, the non permanent credentials expire in 900 seconds. You’ll be able to optionally specify a length between 900–3600 seconds (15–60 minutes).
- Join utilizing JDBC/ODBC or psql
Use the issued credentials in your connection string. For JDBC:
For psql:
Validate and monitor
- Take a look at authentication flows end-to-end utilizing your ETL jobs.
- Assessment AWS CloudTrail logs to validate. It information function assumptions and Amazon Redshift API calls.
- Monitor session expiration to assist workloads deal with credential refresh seamlessly.
Testing end-to-end connectivity for Amazon Redshift Serverless
The testing course of for Amazon Redshift Serverless follows an identical sample to provisioned clusters, with minor variations within the API calls and connection parameters. These steps validate connectivity to your serverless workgroup.
- Confirm community connectivity
telnet my-serverless-workgroup.abc123.us-east-1.redshift.amazonaws.com 5439
- Retrieve Amazon Redshift Serverless database credentials
- Join utilizing JDBC/ODBC or psql
Clear up
To keep away from future prices, take away the deployed sources:
- Delete the CloudFormation stack.
- Take away the generated recordsdata from CloudShell:
rm cert_export.json encrypted_private_key.pem certificates.pem private_key.pem
Conclusion
On this submit, we confirmed how one can implement IAM Roles Wherever with Amazon Redshift in order that enterprises can securely join on-premises knowledge techniques to their cloud knowledge warehouse with out counting on static credentials or public web entry. This structure supplies short-lived, auditable credentials, integrates with current certificates authorities, and helps guarantee authentication and knowledge flows stay personal and trusted.
With this strategy, knowledge engineers and builders can run ingestion pipelines, ETL jobs, and analytics queries, whereas safety groups preserve full management via IAM governance and CloudTrail auditing. You’ll be able to take away guide credential rotation duties, enable your knowledge engineers to connect with Amazon Redshift with out managing static keys, and obtain full audit trails via CloudTrail integration to your hybrid analytics environments.
To get began, deploy the answer utilizing the CloudFormation template and observe the steps on this submit. To study extra concerning the companies used, see the next sources:
