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

Required AWS variables not actually required #110

Open
1davidmichael opened this issue Oct 26, 2022 · 0 comments
Open

Required AWS variables not actually required #110

1davidmichael opened this issue Oct 26, 2022 · 0 comments

Comments

@1davidmichael
Copy link
Contributor

Currently environment variables for AWS are required to be set. However, they are particular instances where the variables are not defined and the AWS SDK handles fetching them via other means.

My specific example is running within a Fargate container. Setting the env variables would be against a best practice and it would be better to use the defined task role to fetch credentials.

2022/10/26 20:43:41 AWS_ACCESS_KEY_ID environment variable is required and not found

I am not super familiar with golang but I believe based on the session created here

func CreateSession(region string) *session.Session {
	sess, err := session.NewSession(&aws.Config{
		Region: aws.String(region)},
	)
	if err != nil {
		logrus.Fatalf("Can't connect to AWS: %s", err.Error())
	}
	return sess
}

func CreateSessionWithoutRegion() (*session.Session, error) {
	sess, err := session.NewSession()
	if err != nil {
		logrus.Errorf("Can't connect to AWS: %s", err)
		return nil, err
	}
	return sess, nil
}

it should handle situations where env vars are not set and credentials are loaded in a different way. So the environment variables are not explicitly needed to work.

@1davidmichael 1davidmichael changed the title Required AWS variables Required AWS variables not actually required Oct 27, 2022
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

1 participant