AWS Code Sample
Catalog

DescribeLimits.java

DescribeLimits.java demonstrates how to display the shard limit and usage for a given account .

/* * Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.example.kinesis; import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient; import software.amazon.awssdk.services.kinesis.KinesisAsyncClient; import software.amazon.awssdk.services.kinesis.model.DescribeLimitsRequest; import software.amazon.awssdk.services.kinesis.model.DescribeLimitsResponse; import java.util.concurrent.ExecutionException; public class DescribeLimits { public static void main(String[] args) { KinesisAsyncClient client = KinesisAsyncClient.builder() .httpClientBuilder(NettyNioAsyncHttpClient.builder() .maxConcurrency(100) .maxPendingConnectionAcquires(10_000)) .build(); DescribeLimitsRequest request = DescribeLimitsRequest.builder() .build(); DescribeLimitsResponse response = client.describeLimits(request).join(); System.out.println("Number of open shards: " + response.openShardCount()); System.out.println("Maximum shards allowed: " + response.shardLimit()); } }

Sample Details

Service: kinesis

Last tested: 2019-06-28

Author: jschwarzwalder AWS

Type: full-example

On this page: