-
I'm running a Rust lambda and looking to configure the credentials to use let config = aws_config::from_env()
.region(Region::new(env_var("AWS_REGION")))
.credentials_provider(EnvironmentVariableCredentialsProvider::new())
.load()
.await;
fn env_var(name: &str) -> String {
match env::var(name) {
Ok(v) => v,
Err(e) => panic!("${} is not set ({})", name, e)
}
} This works in AWS lambda, however, I see that before loading the credentials from environment it will attempt to load the profile files:
That's My next attempt was to remove the profile files: let config = aws_config::from_env()
.region(Region::new(env_var("AWS_REGION")))
.credentials_provider(EnvironmentVariableCredentialsProvider::new())
.profile_files(ProfileFiles::builder()
.include_default_config_file(false)
.include_default_credentials_file(false)
.build()
)
.load()
.await; However, it seems at least one profile file is required:
I'm wondering why the profile files are always loaded even when |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I doubt that the 33ms is actually from loading the profile file. You can hardcode an empty profile file if you want to test this—https://docs.rs/aws-config/latest/aws_config/profile/profile_file/struct.Builder.html#method.with_contents. Let me know what you find! You might also try /~https://github.com/rcoh/tracing-texray to see what's going on |
Beta Was this translation helpful? Give feedback.
I doubt that the 33ms is actually from loading the profile file. You can hardcode an empty profile file if you want to test this—https://docs.rs/aws-config/latest/aws_config/profile/profile_file/struct.Builder.html#method.with_contents.
Let me know what you find!
You might also try /~https://github.com/rcoh/tracing-texray to see what's going on