User guide
Because this example replaces the WLM configuration, this JSON configuration also defines the default
queue with no specific user group or query group. It sets the concurrency to the default value, 5.
{
"query_concurrency":5
}
For more information about Workload Management (WML) configuration, go to Implementing workload
management.
For step-by-step instructions to run the following example, see Running Java Examples for Amazon
Redshift Using Eclipse (p. 130).You need to update the code and provide a cluster identifier.
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.PropertiesCredentials;
import com.amazonaws.services.redshift.AmazonRedshiftClient;
import com.amazonaws.services.redshift.model.*;
public class CreateAndModifyClusterParameterGroup {
public static AmazonRedshiftClient client;
public static String clusterParameterGroupName = "parametergroup1";
public static String clusterIdentifier = "***provide cluster identifier***";
public static String parameterGroupFamily = "redshift-1.0";
public static void main(String[] args) throws IOException {
AWSCredentials credentials = new PropertiesCredentials(
CreateAndModifyClusterParameterGroup.class
.getResourceAsStream("AwsCredentials.properties"));
client = new AmazonRedshiftClient(credentials);
try {
createClusterParameterGroup();
modifyClusterParameterGroup();
associateParameterGroupWithCluster();
describeClusterParameterGroups();
} catch (Exception e) {
System.err.println("Operation failed: " + e.getMessage());
}
}
private static void createClusterParameterGroup() {
CreateClusterParameterGroupRequest request = new CreateClusterParamet
erGroupRequest()
.withDescription("my cluster parameter group")
.withParameterGroupName(clusterParameterGroupName)
.withParameterGroupFamily(parameterGroupFamily);
client.createClusterParameterGroup(request);
System.out.println("Created cluster parameter group.");
}
API Version 2012-12-01
78
Amazon Redshift Management Guide
Managing Parameter Groups Using the AWS SDK for
Java