Skip to content

Passing AWS profile credentials to Dask Gateway workers #331

Closed Answered by rsignell-usgs
rsignell-usgs asked this question in Q&A
Discussion options

You must be logged in to vote

@brl0, very nice.

So now I first use the approach of @jkellndorfer to set the env vars from the config file, then set them for the workers using your approach.

So the whole thing looks like this:

import configparser
import os
def set_aws_credentials(cfile=os.path.join(os.environ['HOME'],'.aws','credentials'),profile_name='default',region_name='us-east-1',endpoint='s3.amazonaws.com',verbose=False):
    '''Sets the aws credentials if not set already and profilename is default'''
    cp = configparser.ConfigParser()
    cp.read(cfile)
    os.environ['aws_access_key_id'.upper()]=cp[profile_name]['aws_access_key_id']	
    os.environ['aws_secret_access_key'.upper()]=cp[profile_name]['aws_secret…

Replies: 8 comments 15 replies

Comment options

You must be logged in to vote
4 replies
@jkellndorfer
Comment options

@rsignell-usgs
Comment options

@jkellndorfer
Comment options

@rsignell-usgs
Comment options

Comment options

You must be logged in to vote
1 reply
@dharhas
Comment options

Comment options

You must be logged in to vote
1 reply
@kcpevey
Comment options

Comment options

You must be logged in to vote
2 replies
@dharhas
Comment options

@rsignell-usgs
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by rsignell-usgs
Comment options

You must be logged in to vote
7 replies
@rsignell-usgs
Comment options

@costrouc
Comment options

@rsignell-usgs
Comment options

@tylerpotts
Comment options

@rsignell-usgs
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
7 participants