Skip to content

Commit

Permalink
Add default provider chain so that it goes through the creds availabl…
Browse files Browse the repository at this point in the history
  • Loading branch information
brainstorm committed Oct 12, 2021
1 parent cd4c600 commit e2f8eb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ serde_derive = "^1"
serde_json = "^1"
lambda_runtime = { version = "0.4.1" }
aws-sdk-s3 = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.19-alpha" }
aws-config = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.19-alpha" }
tracing-subscriber = "0.2.25"

tokio = { version = "1.12.0" }
noodles = { version = "0.10.1", features = ["bam", "sam"] }

Expand Down
6 changes: 6 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::io::{Cursor};
use lambda_runtime::{ handler_fn, Context, Error };
use serde_json::{ json, Value };

use aws_config::default_provider::credentials::DefaultCredentialsChain;
use aws_sdk_s3 as s3;
use s3::Region;

Expand Down Expand Up @@ -44,8 +45,13 @@ async fn s3_read_bam_header(_event: Value, _ctx: Context) -> Result<Value, Error

/// Fetches S3 object
async fn stream_s3_object() -> Result<Bytes, Error> {
let creds_provider = DefaultCredentialsChain::builder()
.region(Region::new(REGION))
.build().await;

let conf = s3::Config::builder()
.region(Region::new(REGION))
.credentials_provider(creds_provider)
.build();
let client = s3::Client::from_conf(conf);

Expand Down

0 comments on commit e2f8eb9

Please sign in to comment.