EasyManua.ls Logo

Amazon Redshift User Manual

Amazon Redshift
131 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #122 background imageLoading...
Page #122 background image
Note
The AWS SDK for Java provides thread-safe clients for accessing Amazon Redshift. As a best
practice, your applications should create one client and reuse the client between threads.
The AmazonRedshiftClient class defines methods that map to underlying Amazon Redshift Query
API actions. (These actions are described in the Amazon Redshift API Reference).When you call a
method, you must create a corresponding request object and response object.The request object includes
information that you must pass with the actual request.The response object include information returned
from Amazon Redshift in response to the request.
For example, the AmazonRedshiftClient class provides the createCluster method to provision a
cluster.This method maps to the underlying CreateCluster API action.You create a
CreateClusterRequest object to pass information with the createCluster method.
AmazonRedshiftClient client = new AmazonRedshiftClient(credentials);
client.setEndpoint("https://redshift.us-east-1.amazonaws.com/");
CreateClusterRequest request = new CreateClusterRequest()
.withClusterIdentifier("exampleclusterusingjava")
.withMasterUsername("masteruser")
.withMasterUserPassword("12345678Aa")
.withNodeType("dw.hs1.xlarge")
.withNumberOfNodes(2);
Cluster createResponse = client.createCluster(request);
System.out.println("Created cluster " + createResponse.getClusterIdentifier());
Running Java Examples for Amazon Redshift
Using Eclipse
General Process of Running Java Code Examples Using Eclipse
1. Create a new AWS Java Project in Eclipse.
Follow the steps in Setting Up the AWS Toolkit for Eclipse in the AWS Toolkit for Eclipse Getting
Started Guide.These steps include configuring the AwsCredentials.properties file that contains
your AWS security credentials.
2. Copy the sample code from the section of this document that you are reading and paste it into your
project as a new Java class file.
3. Run the code.
Running Java Examples for Amazon Redshift from
the Command Line
General Process of Running Java Code Examples from the Command Line
1. Set up and test your environment as follows:
a. Create a directory to work in and in it create src, bin, and sdk subfolders.
b. Download the AWS SDK for Java and unzip it to the sdk subfolder you created. After you unzip the
SDK, you should have four subdirectories in the sdk folder, including a lib and third-party
folder.
API Version 2012-12-01
118
Amazon Redshift Management Guide
Running Java Examples Using Eclipse

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the Amazon Redshift and is the answer not in the manual?

Amazon Redshift Specifications

General IconGeneral
ProviderAmazon Web Services (AWS)
Query LanguageSQL
Data StorageColumnar storage
SecurityEncryption at rest and in transit, VPC, IAM
BackupAutomated and manual snapshots
DeploymentCloud-based
TypeCloud-based data warehouse service
Primary UseData warehousing, analytics
IntegrationIntegrates with AWS services, BI tools, and ETL tools
Pricing ModelOn-demand and reserved instance pricing
Data CompressionColumnar storage with data compression
Performance OptimizationQuery optimization

Summary

Amazon Redshift Clusters

Managing Clusters Using the Console

Details how to create, modify, delete, reboot, and resize clusters using the AWS Management Console.

Manage Clusters Using Amazon Redshift CLI and API

Managing Clusters in Virtual Private Cloud (VPC)

Creating a Cluster in a VPC

Outlines the general steps to deploy an Amazon Redshift cluster within a VPC, including VPC setup and subnet groups.

Amazon Redshift Cluster Subnet Groups

Managing Cluster Subnet Groups Using the Console

Provides instructions for creating, modifying, and deleting cluster subnet groups via the Amazon Redshift console.

Amazon Redshift Cluster Security Groups

Managing Security Groups Using the Console

Details how to create, modify, delete, and associate security groups with clusters using the console.

Amazon Redshift Parameter Groups

Amazon Redshift Snapshots

Monitoring Amazon Redshift Cluster Performance

Viewing Cluster Performance Data

Guides on how to view cluster metrics, identify performance issues, and analyze query impact.

Viewing Cluster Metrics During Query Execution

Shows how to view cluster metrics during query execution to identify performance bottlenecks.

Viewing Cluster Metrics During Load Operations

Explains how to view cluster metrics during load operations to identify resource-consuming queries.

Purchasing Amazon Redshift Reserved Nodes

Purchasing Reserved Node Offerings

Step-by-step guide to purchasing reserved node offerings through the Amazon Redshift console.

Controlling Access to Amazon Redshift Resources

Connecting to a Cluster

Setting Up the SQL Workbench Client

Provides detailed steps to set up SQL Workbench/J, a query tool, for connecting to Amazon Redshift clusters.

Connect to Your Cluster Programmatically

Connect from Outside of Amazon EC2 - Firewall Timeout Issue

Using the AWS SDKs with Amazon Redshift

Using the AWS SDK for Java with Amazon Redshift

Focuses on using the AWS SDK for Java to interact with Amazon Redshift, including client setup and examples.

Uploading Client-Side Encrypted Data for Use in Amazon Redshift

Signing an HTTP Request

Related product manuals