[HTML payload içeriği buraya]
28.2 C
Jakarta
Monday, April 20, 2026

Securely connecting on-premises knowledge techniques to Amazon Redshift with IAM Roles Wherever


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

  1. Navigate to the AWS CloudFormation console.
  2. Select Create Stack.
  3. Obtain the redshift-iamra-template template.
  4. For Specify template, select Add a template file and add redshift-iamra-template.
  5. Select Subsequent.
  6. Enter a novel title for Stack title. The default worth is redshift-test.
  7. Configure the stack parameters. The next desk supplies default values.
Parameter titleDefault worthDescription
VPCCIDR10.0.0.0/16CIDR block for the VPC
PrivateSubnet1CIDR10.0.1.0/24CIDR block for the primary personal subnet
PrivateSubnet2CIDR10.0.2.0/24CIDR block for the second personal subnet
CACommonNameredshift-ca.instance.comFrequent Identify for the Certificates
CAOrganizationInstance CorpGroup for the Certificates Authority
CACountryUSNation for the Certificates Authority
CAValidityInDays1826Validity interval in days for the CA Certificates (5 years)
RedshiftClusterIdentifiermy-redshift-clusterIdentifier for the Amazon Redshift cluster
RedshiftDatabaseNamedevIdentify of the preliminary database within the Amazon Redshift cluster
RedshiftMasterUsernameadminFundamental username for the Amazon Redshift cluster
RedshiftNodeTypera3.xlplusNode kind for the Amazon Redshift cluster
ServerlessNamespacemy-serverless-namespaceNamespace identifier for Amazon Redshift Serverless
ServerlessWorkgroupmy-serverless-workgroupWorkgroup identifier for Amazon Redshift Serverless
  1. Choose the acknowledgement checkbox and select Create Stack. Stack deployment takes about 10 minutes to finish.
  1. 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.

OutputDescriptionInstance worth
CertificateAuthorityArnAmazon Useful resource Identify (ARN) of the Non-public Certificates Authorityarn:aws:acm-pca:aa-example-1:111122223333:certificate-authority/a1b2c3d4-5678-90ab-cdef-EXAMPLE22222
ClientCertificateArnARN of the pattern shopper certificatesarn:aws:acm:aa-example-1:111122223333:certificates/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
ProfileArnARN of the IAM Roles Wherever profilearn:aws:rolesanywhere:aa-example-1:111122223333:profile/a1b2c3d4-5678-90ab-cdef-EXAMPLE44444
RedshiftAccessRoleArnARN of the Amazon Redshift Entry functionarn:aws:iam::1222345677:function/Redshift-test-RedshiftAccessRole
TrustAnchorArnARN 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
RedshiftClusterEndpointNon-public endpoint of the Amazon Redshift Clustermy-redshift-cluster-123456789012.aa-example-1.redshift.amazonaws.com
RedshiftClusterPortPort of the Amazon Redshift Cluster5439
ServerlessWorkgroupEndpointNon-public endpoint of Amazon Redshift Serverless Workgroupmy-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.

  1. Open CloudShell. For extra particulars, see Navigating the AWS CloudShell interface.
  2. 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 worth redshift-public-iam-roles-anywhere.
export CERT_ARN=$(aws cloudformation describe-stacks 
    --stack-name <stack-name> 
    --query 'Stacks[0].Outputs[?OutputKey==`ClientCertificateArn`].OutputValue' 
    --output textual content)

  1. Extract the certificates and personal key recordsdata:
# Generate and save the passphrase
export PASSPHRASE=$(openssl rand -base64 32)
# Export certificates utilizing surroundings variables
aws acm export-certificate 
    --certificate-arn $CERT_ARN 
    --passphrase $(echo -n "$PASSPHRASE" | base64) 
    > cert_export.json
# Extract elements to separate recordsdata
jq -r '.Certificates' cert_export.json > certificates.pem
jq -r '.PrivateKey' cert_export.json > encrypted_private_key.pem
# Decrypt the personal key
openssl rsa -in encrypted_private_key.pem -out private_key.pem -passin move:"$PASSPHRASE"
# Clear surroundings variables
unset PASSPHRASE CERT_ARN

  1. Obtain the extracted certificates and personal key recordsdata from CloudShell:
/residence/cloudshell-user/certificates.pem
/residence/cloudshell-user/private_key.pem

  1. Safe the personal key in your native workstation.

After downloading the recordsdata, prohibit file permissions to forestall unauthorized entry:

chmod 400 private_key.pem chmod 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:

  1. 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.
  2. 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 for trusted-anchor-arnprofile-arn, and role-arn in your CloudFormation stack outputs.
aws configure set profile.onprem-redshift.credential_process "</path/to/aws_signing_helper> credential-process 
      --certificate </path/to/certificates.pem> 
      --private-key </path/to/private_key.pem> 
      --trust-anchor-arn <trusted-anchor-arn> 
      --profile-arn <profile-arn> 
      --role-arn < role-arn>"

  1. Confirm your configuration. Open the ~/.aws/config file and make sure that it accommodates a profile.
[profile onprem-redshift]
credential_process = </path/to/aws_signing_helper> credential-process       
--certificate </path/to/certificates.pem>       
--private-key </path/to/private_key.pem>       
--trust-anchor-arn <trusted-anchor-arn>       
--profile-arn <profile-arn>       
--role-arn <role-arn>

Take a look at the answer

Observe these steps to validate your setup for provisioned clusters to verify end-to-end connectivity:

  1. 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.

  1. 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]';

  1. Retrieve Amazon Redshift database credentials

With the configuration in place, request non permanent database credentials from Amazon Redshift:

aws redshift get-cluster-credentials 
  --db-user analytics_user 
  --cluster-identifier my-redshift-cluster 
  --region us-east-1 
  --profile onprem-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).

  1. Join utilizing JDBC/ODBC or psql

Use the issued credentials in your connection string. For JDBC:

jdbc:redshift://my-redshift-cluster.abc123.redshift.amazonaws.com:5439/dev?ssl=true&UID=analytics_user&PWD=<temporary_password>

For psql:

PGPASSWORD=<temporary_password> psql 
  -h my-redshift-cluster.abc123.redshift.amazonaws.com 
  -p 5439 
  -U analytics_user 
  -d dev 
  --set=sslmode=verify-full

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.

  1. Confirm community connectivity

telnet my-serverless-workgroup.abc123.us-east-1.redshift.amazonaws.com 5439

  1. Retrieve Amazon Redshift Serverless database credentials
aws redshift-serverless get-credentials 
  --workgroup-name my-serverless-workgroup 
  --db-name dev 
  --region us-east-1 
  --profile onprem-redshift

  1. Join utilizing JDBC/ODBC or psql
PGPASSWORD="<password_from_get_credentials>" psql 
  -h my-serverless-workgroup.abc12.us-east-1.redshift-serverless.amazonaws.com 
  -p 5439 
  -U "IAMR:Redshift-IAMRA-RedshiftAccessRole" 
  -d dev 
  --set=sslmode=verify-full

Clear up

To keep away from future prices, take away the deployed sources:

  1. Delete the CloudFormation stack.
  2. 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:


Concerning the authors

Kanwar Bajwa is a Principal Enterprise Account Engineer at AWS who works with prospects to optimize their use of AWS companies and obtain their enterprise aims.

Xiaoxue Xu is a Options Architect for AWS primarily based in Toronto. She primarily works with Monetary Companies prospects to assist safe their workload and design scalable options on the AWS Cloud.

Zainab Syeda is a Technical Account Supervisor at Amazon Net Companies in Toronto. She works with prospects within the Monetary Companies section, serving to them leverage cloud-native options at scale.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles