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 #126 background imageLoading...
Page #126 background image
String sourceDir = getProperty(config, "src_dir");
SecretKey mySymmetricKey = new SecretKeySpec( Base64.decodeBase64(masterSym
metricKeyBase64.getBytes()) , "AES");
EncryptionMaterials materials = new EncryptionMaterials(mySymmetricKey);
AmazonS3 s3 = new AmazonS3EncryptionClient(credentials, materials);
s3.setEndpoint(s3Endpoint);
// Upload all files.
uploadAllFilesToS3(s3, bucketName, s3Prefix, new File(sourceDir) );
}
private static void uploadAllFilesToS3(AmazonS3 s3, String bucketName, String
s3Prefix, final File folder) {
System.out.println("Reading files from directory "+folder);
for (final File fileEntry : folder.listFiles()) {
if (! fileEntry.isDirectory()) { // Skip sub directories.
int retryCount = 0;
boolean done = false;
while ( !done ) {
try {
uploadToS3(s3, bucketName, s3Prefix, fileEntry);
done = true;
}catch (Exception e ){
retryCount++;
if ( retryCount > MAX_RETRY_COUNT ) {
System.out.println("Retry count exceeded max retry count
"+MAX_RETRY_COUNT+". Giving up");
throw new RuntimeException(e);
}
// Do retry after 10 seconds.
System.out.println("Failed to upload file "+fileEntry+". Retry
ing...");
try {
Thread.sleep(10 * 1000);
}catch(Exception te) {}
}
}// while
}// for
}
}
private static void uploadToS3(AmazonS3 s3, String bucketName, String s3Prefix,
File file) {
try {
System.out.println("Uploading a new object to S3 object '"+s3Prefix+"'
from file "+file);
String key = s3Prefix+"/"+file.getName();
s3.putObject(new PutObjectRequest(bucketName, key, file) );
API Version 2012-12-01
122
Amazon Redshift Management Guide
Example: Uploading Client-Side Encrypted Data

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