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

[Bugs] Program cannot start on IMDS-v2 credentials #179

Closed
benriou opened this issue Jul 29, 2024 · 2 comments · Fixed by #181
Closed

[Bugs] Program cannot start on IMDS-v2 credentials #179

benriou opened this issue Jul 29, 2024 · 2 comments · Fixed by #181
Labels
bug Something isn't working

Comments

@benriou
Copy link

benriou commented Jul 29, 2024

Describe the bug
CLS3 cannot start when the AWS credentials requires to be refreshed.

To Reproduce
Start an EC2 with Assumed Role. The issue happens with IMDSv2 required or optional.

The instance is properly started and has an available role, and can proceed allowed operations within its role.

[ssm-user@ip-172-31-89-44 bin]$ aws s3 ls
2024-05-22 08:46:49 BUCKET_1
2024-05-22 08:43:46 BUCKET_2
2024-05-14 11:14:42 BUCKET_3

Install CLS3 with the standard procedure

 curl -fsSL https://raw.github.com/go-to-k/cls3/main/install.sh | sh

Start the CLS3 program and try an operation :

[root@ip-172-31-89-44 tmp]# cls3 --bucketName poc-playground-2
ERR [resource -] operation error S3: ListBuckets, get identity: get credentials: failed to refresh cached credentials, no EC2 IMDS role found, not found, Signing

Current workaround
This seems to be an issue with missing updates on Go libraries, as described here

I applied the workaround offered here

Download CLS3 source code and update go libraries

go get github.com/aws/aws-sdk-go-v2/internal/endpoints/v2
go get -u "github.com/aws/aws-sdk-go-v2/...
go mod tidy
go build -ldflags "$(LDFLAGS)" -o cls3 cmd/cls3/main.go
go install -ldflags "$(LDFLAGS)" github.com/go-to-k/cls3/cmd/cls3

Then restarted the CLS3 and it worked

[root@ip-172-31-89-44 cls3]# ./cls3 --bucketName MyBucket
DBG Debug mode...
INF MyBucket Checking...
Clearing... 89000 objects

Environment

EC2 instance with IAM Instance Profile
IMDSv1 or v2 required : same result.

Summary

Go AWS SDK libraries needs to be updated.

@benriou benriou added the bug Something isn't working label Jul 29, 2024
@go-to-k
Copy link
Owner

go-to-k commented Jul 29, 2024

This issue is also very helpful. Thank you.
I will update the Go SDK version.

@go-to-k
Copy link
Owner

go-to-k commented Aug 1, 2024

This is also included in v0.18.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants