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

all: migrate aws-sdk-go to aws-sdk-go-v2 #3220

Closed
AaronFriel opened this issue Jan 24, 2023 · 10 comments
Closed

all: migrate aws-sdk-go to aws-sdk-go-v2 #3220

AaronFriel opened this issue Jan 24, 2023 · 10 comments

Comments

@AaronFriel
Copy link

Is your feature request related to a problem? Please describe.

Migrating to the new SDK places the project on surer footing, using the currently supported SDK and reduces module weight. See: https://aws.github.io/aws-sdk-go-v2/docs/migrating/

Describe the solution you'd like

Updates to packages such as blob/s3blob to use the new SDK.

Describe alternatives you've considered

n/a - alternatives are absurd, i.e.: reimplement AWS SDK from scratch.

Additional context

The AWS SDK for Go is still in GA, that is, there is no immediate risk of the aws-sdk-go v1 beocming unsupported.

That said, the newer SDK reduces dependency weight and is likely to be more actively maintained.

AaronFriel added a commit to pulumi/pulumi that referenced this issue Jan 24, 2023
Having previously made a pull request removing azure-sdk-for-go as a dependency
of gocloud.dev, this PR updates the CLI to remove the transitive dependency.

Removing the dependency on azure-sdk-for-go reduces module cache weight by
492MiB. That's the apparent size of `~/go/pkg/mod/github.com/!azure` according
to a disk usage utility.

This makes the new largest targets for reducing size:

```
258 MiB google.golang.org/[email protected]
        - required by
250 MiB github.com/aws/[email protected]
        - required by pulumi/pkg/operations, an experimental function, not used
 83 MiB github.com/pierrec/[email protected]+incompatible
        - required by gocloud.dev/secrets/hashivault
 25 MiB github.com/pulumi/pulumi-java
...
```

Returns rapidly diminish with most packages weighing under 1MiB after these.

Follow up work
==============

I've made an upstream issue with gocloud.dev to migrate off aws-sdk-go@v1:
- google/go-cloud#3220

Moving storage backends to plugins would allow us to remove this and many other
dependencies from the Pulumi CLI repository and remove conflicts between the
Pulumi engine and providers. See:
- pulumi/pulumi-vault#197
AaronFriel added a commit to pulumi/pulumi that referenced this issue Jan 24, 2023
Having previously made a pull request removing azure-sdk-for-go as a dependency
of gocloud.dev, this PR updates the CLI to remove the transitive dependency.

Removing the dependency on azure-sdk-for-go reduces module cache weight by
492MiB. That's the apparent size of `~/go/pkg/mod/github.com/!azure` according
to a disk usage utility.

This makes the new largest targets for reducing size:

```
258 MiB google.golang.org/[email protected]
        - required by
250 MiB github.com/aws/[email protected]
        - required by pulumi/pkg/operations, an experimental function, not used
 83 MiB github.com/pierrec/[email protected]+incompatible
        - required by gocloud.dev/secrets/hashivault
 25 MiB github.com/pulumi/pulumi-java
...
```

Returns rapidly diminish with most packages weighing under 1MiB after these.

Follow up work
==============

I've made an upstream issue with gocloud.dev to migrate off aws-sdk-go@v1:
- google/go-cloud#3220

Moving storage backends to plugins would allow us to remove this and many other
dependencies from the Pulumi CLI repository and remove conflicts between the
Pulumi engine and providers. See:
- pulumi/pulumi-vault#197
AaronFriel added a commit to pulumi/pulumi that referenced this issue Jan 24, 2023
Having previously made a pull request removing azure-sdk-for-go as a dependency
of gocloud.dev, this PR updates the CLI to remove the transitive dependency.

Removing the dependency on azure-sdk-for-go reduces module cache weight by
492MiB. That's the apparent size of `~/go/pkg/mod/github.com/!azure` according
to a disk usage utility.

This makes the new largest targets for reducing size:

```
258 MiB google.golang.org/[email protected]
        - required by
250 MiB github.com/aws/[email protected]
        - required by pulumi/pkg/operations, an experimental function, not used
 83 MiB github.com/pierrec/[email protected]+incompatible
        - required by gocloud.dev/secrets/hashivault
 25 MiB github.com/pulumi/pulumi-java
...
```

Returns rapidly diminish with most packages weighing under 1MiB after these.

Follow up work
==============

I've made an upstream issue with gocloud.dev to migrate off aws-sdk-go@v1:
- google/go-cloud#3220

Moving storage backends to plugins would allow us to remove this and many other
dependencies from the Pulumi CLI repository and remove conflicts between the
Pulumi engine and providers. See:
- pulumi/pulumi-vault#197
bors bot added a commit to pulumi/pulumi that referenced this issue Jan 24, 2023
11963: chore: Update gocloud.dev, removing azure-sdk-for-go dep r=AaronFriel a=AaronFriel

Having previously made a pull request removing azure-sdk-for-go as a dependency of gocloud.dev, this PR updates the CLI to remove the transitive dependency.

Removing the dependency on azure-sdk-for-go reduces module cache weight by 492MiB. That's the apparent size of `~/go/pkg/mod/github.com/!azure` according to a disk usage utility.

This makes the new largest targets for reducing size:

```
258 MiB google.golang.org/[email protected]
        - required by
250 MiB github.com/aws/[email protected]
        - required by pulumi/pkg/operations, an experimental function, not used
 83 MiB github.com/pierrec/[email protected]+incompatible
        - required by gocloud.dev/secrets/hashivault
 25 MiB github.com/pulumi/pulumi-java
...
```

Returns rapidly diminish with most packages weighing under 1MiB after these.

Follow up work
==============

I've made an upstream issue with gocloud.dev to migrate off aws-sdk-go@v1:
- google/go-cloud#3220

Moving storage backends to plugins would allow us to remove this and many other dependencies from the Pulumi CLI repository and remove conflicts between the Pulumi engine and providers. See:
- pulumi/pulumi-vault#197


Co-authored-by: Aaron Friel <[email protected]>
@vangent
Copy link
Contributor

vangent commented Jan 24, 2023

Already done?

E.g.,

https://pkg.go.dev/[email protected]/blob/s3blob#OpenBucketV2

https://pkg.go.dev/[email protected]/blob/s3blob#URLOpener
("Use "awssdk=v1" to force using AWS SDK v1, "awssdk=v2" to force using AWS SDK v2, or anything else to accept the default.")

@AaronFriel
Copy link
Author

Ah, my issue is intended to describe a migration that involves removing the aws-sdk-go dependency, as it's ~250MiB. As it stands, from a dependency size and security perspective right now we've got the worst of both.

From a compatibility perspective, of course I understand needing to gracefully migrate clients over to awssdk=v2.

@vangent
Copy link
Contributor

vangent commented Jan 24, 2023

Sorry, I'm not sure how to make that happen and maintain backwards compatibility.... and I'm not sure of the timeframe in which it would be OK to drop v1.

@AaronFriel
Copy link
Author

That makes sense.

I was looking at why CI takes so long to build a project and gocloud.dev was a substantial portion of the CI time and cache usage. Updating to the v0.28 which from my PR & your help removed azure-sdk-for-go reduced the dependency weight by about 500MiB.

This is not an urgent issue, if you think it makes sense to close because it's premature feel free. I think this would be a good goal for some vNext in the future or a v1/v2 release of gocloud.dev. There are some really heavy packages in the dependency graph.

@vangent
Copy link
Contributor

vangent commented Jan 24, 2023

This is a known issue and not likely to change, sorry. It's inherent in having a multi-cloud library that we're going to have dependencies from multiple cloud providers (and in some cases, multiple dependencies even from one cloud provider).

If at some point AWS announces they are no longer supporting v1, I would be OK with removing the v1 code in Go CDK, but I don't think that will happen for O(years) and probably wouldn't help that much anyway (it might get rid of another 500MB, but you're still including GCS, Azure, etc.).

If you have ideas on how to reduce the dependency graph while still keeping support for multiple providers, let me know. I believe it is only a CI issue, at runtime Go won't load libraries you aren't using.

@vangent vangent closed this as completed Jan 24, 2023
@AaronFriel
Copy link
Author

You're right that it's primarily a CI and developer loop issue. Starting with a clean cache or when switching between projects using different versions of gocloud.dev causes large download times, poor developer experience.

For what it's worth the PR you helped move across the finish line removed 500MiB of Azure dependencies. Perhaps it's worth revisiting: why do we have awssdk=v2 and awssdk=v1 when the latter can be made a drop-in replacement for the former? Are there defaults this library isn't setting that it could set, so that awssdk=v1 can be removed and that query parameter made obsolete?

@vangent
Copy link
Contributor

vangent commented Jan 24, 2023

the latter can be made a drop-in replacement for the former

It can't though. The constructors and various As functions include types that are from either v1 or v2. I could get rid of v1, but it would require all users of Go CDK to update their code to use AWS v2 in order to keep using Go CDK, which I'm not really comfortable doing. I felt more comfortable with that for Azure because a) I believe there are fewer users, although it's hard to be sure, and b) Azure has been very aggressive about the upgrade, essentially stopping support for the old version while the new one was still in beta (twice), while AWS (as far as I can tell) continues to support both.

I work for Google so I'm not super in touch with what AWS is doing; if there's some evidence that some high percentage of users have updated to the AWS V2 APIs or will be forced to do so soon that would be good to know.

@AaronFriel
Copy link
Author

That makes sense, thanks!

I'd still be interested in a future v1/v2 release that removed legacy cloud APIs, but understand that's far enough off that it doesn't make sense to track in this issue.

@khrm
Copy link
Contributor

khrm commented Oct 4, 2024

@vangent Amazon has announced the end of support for v1.
Can we now remove this?

https://aws.amazon.com/blogs/developer/announcing-end-of-support-for-aws-sdk-for-go-v1-on-july-31-2025/

@khrm
Copy link
Contributor

khrm commented Oct 4, 2024

I created a new issue to track this. If any help is required on this, then please inform.
#3489

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants