Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade AWS SDK v1 to v2 #7372

Merged
merged 91 commits into from
Jun 2, 2023
Merged

Conversation

dblock
Copy link
Member

@dblock dblock commented May 2, 2023

Description

Upgrading AWS SDK v1 to v2 in discovery-ec2 and repository-s3.

This PR contains the following potentially breaking changes for end-users.

  • The AWS SDK v2 uses aws.ec2MetadataServiceEndpoint instead of com.amazonaws.sdk.ec2MetadataServiceEndpointOverride. If a user set the IMDS endpoint before that will no longer work without a change. Similarly we've renamed com.amazonaws.sdk.stsEndpointOverride to aws.stsEndpoint. What are the use-cases where anyone would actually do this, or was it done for testing only?
  • AWS SDK v2 introduced a concept of TokenBucketRetryCondition, which effectively limits retries on a bucket level for APIs that have been failing continuously. It allocates tokens (default is 500), which means that once 500 retries fail for any API on a bucket, new retries will only be allowed once some retries are rejected.

The AWS SDK has other changes, see https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/migration-client-changes.html and https://github.com/aws/aws-sdk-java-v2/blob/master/docs/LaunchChangelog.md for all changes between AWS SDK v1 and v2.

Related Issues

Resolves #7312.

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@github-actions

This comment was marked as outdated.

@dblock dblock mentioned this pull request May 2, 2023
2 tasks
@github-actions

This comment was marked as outdated.

@Bukhtawar
Copy link
Collaborator

Code scan for dependencies, looks like we have just the two plugins consuming AWS SDK

@dblock dblock changed the title Upgrade AWS SDK v1 to v2 Upgrade AWS SDK v1 to v2 in discovery-ec2 May 3, 2023
@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as outdated.

Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
… as a host.

Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
@github-actions

This comment was marked as outdated.

Signed-off-by: dblock <dblock@amazon.com>
Signed-off-by: dblock <dblock@amazon.com>
@github-actions

This comment was marked as outdated.

Signed-off-by: dblock <dblock@amazon.com>
@github-actions

This comment was marked as outdated.

Signed-off-by: dblock <dblock@amazon.com>
@github-actions

This comment was marked as outdated.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: UNSTABLE ❕
  • TEST FAILURES:
      1 org.opensearch.indices.replication.SegmentReplicationIT.testReplicationPostDeleteAndForceMerge

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2023

Gradle Check (Jenkins) Run Completed with:

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2023

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Raghuvansh Raj <raghraaj@amazon.com>
@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2023

Gradle Check (Jenkins) Run Completed with:

@raghuvanshraj
Copy link
Contributor

@Bukhtawar I've captured all follow up items here: #7885

@Bukhtawar Bukhtawar merged commit b15ffc9 into opensearch-project:main Jun 2, 2023
@reta
Copy link
Collaborator

reta commented Jun 2, 2023

@dblock we are bringing it to 2.x ? :-)

@dblock
Copy link
Member Author

dblock commented Jun 2, 2023

@dblock we are bringing it to 2.x ? :-)

Yes, we should. However we do have some seemingly breaking changes (see description). WDYT? I'll start a backport anyway.

@dblock dblock deleted the aws-sdk-v2 branch June 2, 2023 18:07
@dblock dblock added the backport 2.x Backport to 2.x branch label Jun 2, 2023
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 128

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-7372-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b15ffc9caaec0303b91ecaff1ab39bb9e860ba48
# Push it to GitHub
git push --set-upstream origin backport/backport-7372-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-7372-to-2.x.

@reta
Copy link
Collaborator

reta commented Jun 2, 2023

We do, but this is a plugin (and those are long due changes), thanks @dblock !

@dblock
Copy link
Member Author

dblock commented Jun 2, 2023

Backport failed above, will need to do a manual one. I can do it next week, @raghuvanshraj lmk if you want to beat me to it.

dblock added a commit to dblock/OpenSearch that referenced this pull request Jun 6, 2023
* AWS SDK v2.
* Migrating com.amazonaws.sdk.ec2MetadataServiceEndpointOverride to aws.ec2MetadataServiceEndpoint per https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/migration-client-changes.html.
* Fetch host address for EC2 metadata service from SdkSettings.
* Deprecations of running with partial keys were removed in AWS SDK v2.
* Underscore is not a valid host name, thus URI.create doesn't treat it as a host.
* Added missing JARs, all tests pass.
* Setup a default AWS profile under config, don't read ~/.aws.
* Re-enable availability zone node attribute implementation.
* Cleaning up privileged calls using SocketAccess
* Consistently setup and teardown AWS settings in repository-s3.
* Using SdkException instead of RuntimeException in S3BlobContainer
* Removing AwsSessionCredentials object from S3BasicSesstionCredentials
* Removing S3BasicCredentials and S3BasicSessionCredentials

Signed-off-by: dblock <dblock@amazon.com>
Co-authored-by: Raghuvansh Raj <raghraaj@amazon.com>
(cherry picked from commit b15ffc9)
dblock added a commit that referenced this pull request Jun 6, 2023
* AWS SDK v2.
* Migrating com.amazonaws.sdk.ec2MetadataServiceEndpointOverride to aws.ec2MetadataServiceEndpoint per https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/migration-client-changes.html.
* Fetch host address for EC2 metadata service from SdkSettings.
* Deprecations of running with partial keys were removed in AWS SDK v2.
* Underscore is not a valid host name, thus URI.create doesn't treat it as a host.
* Added missing JARs, all tests pass.
* Setup a default AWS profile under config, don't read ~/.aws.
* Re-enable availability zone node attribute implementation.
* Cleaning up privileged calls using SocketAccess
* Consistently setup and teardown AWS settings in repository-s3.
* Using SdkException instead of RuntimeException in S3BlobContainer
* Removing AwsSessionCredentials object from S3BasicSesstionCredentials
* Removing S3BasicCredentials and S3BasicSessionCredentials

Signed-off-by: dblock <dblock@amazon.com>
Co-authored-by: Raghuvansh Raj <raghraaj@amazon.com>
(cherry picked from commit b15ffc9)
gaiksaya pushed a commit to gaiksaya/OpenSearch that referenced this pull request Jun 26, 2023
…t#7926)

* AWS SDK v2.
* Migrating com.amazonaws.sdk.ec2MetadataServiceEndpointOverride to aws.ec2MetadataServiceEndpoint per https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/migration-client-changes.html.
* Fetch host address for EC2 metadata service from SdkSettings.
* Deprecations of running with partial keys were removed in AWS SDK v2.
* Underscore is not a valid host name, thus URI.create doesn't treat it as a host.
* Added missing JARs, all tests pass.
* Setup a default AWS profile under config, don't read ~/.aws.
* Re-enable availability zone node attribute implementation.
* Cleaning up privileged calls using SocketAccess
* Consistently setup and teardown AWS settings in repository-s3.
* Using SdkException instead of RuntimeException in S3BlobContainer
* Removing AwsSessionCredentials object from S3BasicSesstionCredentials
* Removing S3BasicCredentials and S3BasicSessionCredentials

Signed-off-by: dblock <dblock@amazon.com>
Co-authored-by: Raghuvansh Raj <raghraaj@amazon.com>
(cherry picked from commit b15ffc9)
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
* AWS SDK v2.
* Migrating com.amazonaws.sdk.ec2MetadataServiceEndpointOverride to aws.ec2MetadataServiceEndpoint per https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/migration-client-changes.html.
* Fetch host address for EC2 metadata service from SdkSettings.
* Deprecations of running with partial keys were removed in AWS SDK v2.
* Underscore is not a valid host name, thus URI.create doesn't treat it as a host.
* Added missing JARs, all tests pass.
* Setup a default AWS profile under config, don't read ~/.aws.
* Re-enable availability zone node attribute implementation.
* Cleaning up privileged calls using SocketAccess
* Consistently setup and teardown AWS settings in repository-s3.
* Using SdkException instead of RuntimeException in S3BlobContainer
* Removing AwsSessionCredentials object from S3BasicSesstionCredentials
* Removing S3BasicCredentials and S3BasicSessionCredentials

Signed-off-by: dblock <dblock@amazon.com>
Co-authored-by: Raghuvansh Raj <raghraaj@amazon.com>
Signed-off-by: Shivansh Arora <hishiv@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade AWS SDK to v2
5 participants