question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: S3 Remote should respect AWS_PROFILE env var if no profile provided in DVC config

See original GitHub issue

I believe that the DVC CLI should utilise the AWS_PROFILE env var when a profile is not provided for a remote

For example, after setting the AWS_PROFILE:

$ export AWS_PROFILE=someprofile

The following command works:

aws s3 ls s3://mybucket

But this command does not:

dvc pull

Similarly, it’s common to set a profile for a one off command:

AWS_PROFILE=someprofile aws s3 ls s3://mybucket

DVC should be invokable in a similar way:

AWS_PROFILE=someprofile dvc fetch

It’s worth noting that DVC already has some implicit behaviour when no profile is provided, it will default to the profile named default which matches the AWS CLI behaviour.

I propose that at this point, DVC should check whether AWS_PROFILE env var is set and use that as the Profile name. If AWS_PROFILE is unset or blank, then default would be used

This means that any aws profiles explicitly set in the DVC config will be respected before using the AWS_PROFILE env var.

Happy to implement this one but wanted to get feedback on it before writing any code

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
pmrowlacommented, Sep 22, 2021

AWS_PROFILE is already handled and supported in the underlying botocore library used to interact with AWS (and the env var does not need to be read at the DVC source level).

Do you have use_accelerate_endpoint set in your AWS config? It’s possible that your problem is related to https://github.com/iterative/dvc/issues/6588

Setting profile = ... in your DVC remote config (instead of using AWS_PROFILE) does change how and where the profile is loaded (which may be why your workaround works, and is potentially what causes the problem in #6588)

1reaction
pmrowlacommented, Jul 21, 2021

@diesal11 it sounds like there is some other issue going on, AWS_PROFILE should already be respected in DVC

can you post the full error log from dvc pull -v

Read more comments on GitHub >

github_iconTop Results From Across the Web

Specify AWS profile when adding external data from S3 - DVC
Hi all, how can I make DVC use a specific AWS-profile when adding ... dvc config cache.s3 s3cache $ dvc add --external s3://my-bucket/remote-data.txt....
Read more >
Support AWS credential settings from environment variables ...
For example: we should be able to run dvc pull despite absence of AWS profiles in ~/.aws if we had set the following...
Read more >
How to efficiently use S3 remote with DVC among multiple ...
There are a few options to achieve this. Use local remote config option to set remote storage config parameters that are specific to...
Read more >
Environment variables to configure the AWS CLI
Specifies an AWS access key associated with an IAM user or role. If defined, this environment variable overrides the value for the profile...
Read more >
cloudposse/tfstate-backend/aws - Terraform Registry
Terraform module that provision an S3 bucket to store the ... S3 buckets and DynamoDB tables when performing terraform plan and terraform ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found