Convert Figma logo to code with AI

aws logoaws-sdk-java

The official AWS SDK for Java 1.x. The AWS SDK for Java 2.x is available here: https://github.com/aws/aws-sdk-java-v2/

4,110
2,827
4,110
0

Top Related Projects

Google Cloud Client Library for Java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.

Quick Overview

The aws/aws-sdk-java repository contains the official AWS SDK for Java, which provides a set of libraries and tools for building Java applications that interact with various AWS services. The SDK simplifies the process of accessing and managing AWS resources, allowing developers to focus on building their applications rather than dealing with the complexities of the AWS platform.

Pros

  • Comprehensive Coverage: The SDK supports a wide range of AWS services, including EC2, S3, DynamoDB, Lambda, and many others, making it a versatile tool for building cloud-based applications.
  • Ease of Use: The SDK provides a consistent and intuitive API, making it easier for developers to interact with AWS services and reducing the learning curve.
  • Automatic Retries and Error Handling: The SDK automatically handles retries and error handling, reducing the amount of boilerplate code developers need to write.
  • Active Development and Support: The SDK is actively maintained and supported by the AWS team, ensuring that it stays up-to-date with the latest AWS features and services.

Cons

  • Complexity: The SDK can be complex, especially for developers new to AWS, as it requires a good understanding of the various AWS services and their interactions.
  • Performance Overhead: The SDK can add some performance overhead to applications, particularly for low-latency use cases, due to the additional abstraction and processing it introduces.
  • Vendor Lock-in: By using the AWS SDK, developers may become more tightly coupled to the AWS platform, which could make it more difficult to migrate to other cloud providers in the future.
  • Learning Curve: Developers who are new to AWS or the SDK may need to invest significant time and effort to become proficient in using the SDK and its various features.

Code Examples

Here are a few examples of how to use the AWS SDK for Java:

  1. Uploading a File to S3:
AmazonS3 s3Client = AmazonS3ClientBuilder.defaultClient();
String bucketName = "my-bucket";
String key = "my-file.txt";
File file = new File("path/to/my-file.txt");

PutObjectRequest request = new PutObjectRequest(bucketName, key, file);
s3Client.putObject(request);
  1. Invoking a Lambda Function:
AWSLambda lambdaClient = AWSLambdaClientBuilder.defaultClient();
String functionName = "my-lambda-function";
InvokeRequest request = new InvokeRequest()
    .withFunctionName(functionName)
    .withPayload("{\"key\":\"value\"}");
InvokeResult result = lambdaClient.invoke(request);
  1. Querying DynamoDB:
AmazonDynamoDB dynamoDbClient = AmazonDynamoDBClientBuilder.defaultClient();
String tableName = "my-table";
QueryRequest request = new QueryRequest()
    .withTableName(tableName)
    .withKeyConditionExpression("id = :id")
    .withExpressionAttributeValues(ImmutableMap.of(":id", new AttributeValue("123")));
QueryResult result = dynamoDbClient.query(request);
  1. Sending an SNS Notification:
AmazonSNS snsClient = AmazonSNSClientBuilder.defaultClient();
String topicArn = "arn:aws:sns:us-west-2:123456789:my-topic";
PublishRequest request = new PublishRequest()
    .withTopicArn(topicArn)
    .withMessage("Hello, AWS!");
PublishResult result = snsClient.publish(request);

Getting Started

To get started with the AWS SDK for Java, follow these steps:

  1. Install Java: Ensure that you have Java 8 or later installed on your system.
  2. Add the SDK to your Project: You can add the AWS SDK for Java to your project using a build tool like Maven or Gradle. For example, in a Maven project, you would add the following dependency to your pom.xml file:
<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactI

Competitor Comparisons

Google Cloud Client Library for Java

Pros of google-cloud-java

  • More modular structure, allowing developers to include only the necessary components
  • Better integration with Google Cloud Platform services
  • Cleaner and more consistent API design across different services

Cons of google-cloud-java

  • Smaller community and fewer third-party resources compared to aws-sdk-java
  • Less comprehensive documentation and examples for some services
  • Potentially steeper learning curve for developers new to Google Cloud

Code Comparison

aws-sdk-java:

AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                        .withRegion(Regions.US_WEST_2)
                        .build();
s3Client.putObject(bucketName, key, content);

google-cloud-java:

Storage storage = StorageOptions.getDefaultInstance().getService();
BlobId blobId = BlobId.of(bucketName, objectName);
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("text/plain").build();
storage.create(blobInfo, content.getBytes(UTF_8));

Both SDKs provide similar functionality for interacting with their respective cloud services. The google-cloud-java example demonstrates a more fluent API design, while aws-sdk-java follows a more traditional object-oriented approach. The choice between the two often depends on the specific cloud platform being used and personal preference in API design.

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.

Pros of azure-sdk-for-java

  • More modular architecture with separate packages for different Azure services
  • Better support for asynchronous operations using Project Reactor
  • Consistent API design across different Azure services

Cons of azure-sdk-for-java

  • Steeper learning curve due to more complex architecture
  • Potentially larger dependency footprint when using multiple Azure services

Code Comparison

azure-sdk-for-java:

BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()
    .connectionString(connectionString)
    .buildClient();

BlobContainerClient containerClient = blobServiceClient.getBlobContainerClient(containerName);
containerClient.createIfNotExists();

aws-sdk-java:

AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
    .withRegion(Regions.US_WEST_2)
    .build();

s3Client.createBucket(bucketName);

The azure-sdk-for-java example demonstrates the use of separate client classes for different levels of abstraction (service and container), while aws-sdk-java uses a single client for all S3 operations. Azure's approach provides more granular control but may require more setup code.

Both SDKs offer similar functionality for interacting with their respective cloud storage services, but azure-sdk-for-java's modular design and consistent API across services can lead to better code organization in larger projects. However, this comes at the cost of increased complexity and potentially larger dependency requirements.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

AWS SDK for Java

The AWS SDK for Java enables Java developers to easily work with Amazon Web Services and build scalable solutions with Amazon S3, Amazon DynamoDB, Amazon Glacier, and more.

See the AWS SDK for Java 2.x for how to get started.

In Maintenance Mode as of July 31, 2024

The AWS SDK for Java 1.x is in maintenance mode. The AWS SDK for Java 1.x entered maintenance mode on July 31, 2024 and will reaching end-of-support on December 31, 2025. During maintenance mode, AWS will limit SDK releases to address critical bug fixes and security issues only. The SDK will not receive API updates for new or existing services, or be updated to support new regions.

We recommend that you migrate to the AWS SDK for Java 2.x. The AWS SDK for Java 2.x provides improved features, enhanced performance, and continued support from AWS. By adopting the latest version of the SDK, developers can ensure the security, compatibility, and stability of their solutions on AWS. Updating also allows you to leverage the latest services and innovations from AWS.

End-of-Support on December 31, 2025

The AWS SDK for Java 1.x will reach end-of-support on December 31, 2025. After end-of- support, AWS will no longer receive updates or releases. Previously published releases will continue to be available via public package managers and the code will remain on GitHub.

Release Notes

Changes to the SDK beginning with version 1.12.1 (June 2021) are tracked in CHANGELOG.md.

Changes in the retired 1.11.x series of the SDK, beginning with version 1.11.82, are listed in the CHANGELOG-1.11.x.md file.

Getting Started with AWS

Use the AWS SDK for Java 2.x to get started.

Using the AWS SDK for Java 1.x

The AWS SDK for Java 1.x is in maintenance mode, so we recommend that you use the AWS SDK for Java 2.x.

Minimum requirements

To run the AWS SDK for Java 1.x, you will need Java 1.8+. For more information about the requirements and optimum settings for the SDK, please see the Installing a Java Development Environment section of the developer guide.

Install the 1.x SDK

You can use the AWS SDK for Java 1.x in your project by consuming it from Maven. Import the aws-java-sdk-bom and specify the SDK Maven modules that your project needs in the dependencies.

Importing the 1.x BOM
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-bom</artifactId>
      <version>1.12.772</version>
      <type>pom</type>
      <scope>import</scope>
    </dependency>
  </dependencies>
</dependencyManagement>
Using the 1.x SDK Maven modules
<dependencies>
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-ec2</artifactId>
  </dependency>
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-s3</artifactId>
  </dependency>
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-dynamodb</artifactId>
  </dependency>
</dependencies>

See the Set up the AWS SDK for Java 1.x section of the developer guide for more information about installing the 1.x SDK through other means.

Building From Source

Once you check out the code from GitHub, you can build it using Maven. To disable the GPG-signing in the build, use:

mvn clean install -Dgpg.skip=true

Getting Help

GitHub issues is the preferred channel to interact with our team. Also check these community resources for getting help:

  • Ask a question on StackOverflow and tag it with aws-java-sdk
  • Articulate your feature request or upvote existing ones on our Issues page
  • Take a look at the blog for plenty of helpful walkthroughs and tips
  • Open a case via the AWS Support Center in the AWS console
  • If it turns out that you may have found a bug, please open an issue

Maintenance and Support for SDK Major Versions

For information about maintenance and support for SDK major versions and their underlying dependencies, see the following in the AWS SDKs and Tools Reference Guide:

Supported Minor Versions

AWS SDK for Java 2.x

A version 2.x of the SDK is generally available. It is a major rewrite of the 1.x code base, built on top of Java 8+ and adds several frequently requested features. These include support for non-blocking I/O, improved start-up performance, automatic iteration over paginated responses and the ability to plug in a different HTTP implementation at run time.

For more information see the AWS SDK for Java 2.x Developer Guide or check the project repository in https://github.com/aws/aws-sdk-java-v2.

Maintenance and Support for Java Versions

The AWS SDK for Java 1.x supports Java versions from 7 to 17, but may not be updated to support future Java versions. To ensure long-term compatibility with the latest JDK versions, we recommend that you migrate to the AWS SDK for Java 2.x.

NPM DownloadsLast 30 Days