pleco
pleco copied to clipboard
Required AWS variables not actually required
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.