Skip to content

how to use hardcoded credentials? #444

Answered by jdisanti
shi-yan asked this question in Q&A
Discussion options

You must be logged in to vote

In general you should prefer to use the credential providers that come with the SDK to get credentials securely, since it isn't secure to hardcode credentials into your application.

That said, if you need to do this, you can take a dependency on aws-types with the feature hardcoded-credentials enabled. This will allow you to use the Credentials::from_keys method.

From there, it would look like:

let creds = Credentials::from_keys("akid", "secret_key", None);
let conf = Config::builder()
    .credentials_provider(creds)
    .region(Region::new("us-east-1"))
    .build();
let client = Client::from_conf(conf);

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@austinbutler
Comment options

@rcoh
Comment options

@DavidSouther
Comment options

Answer selected by rcoh
Comment options

You must be logged in to vote
0 replies
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
6 participants