diff --git a/README.md b/README.md index 1bd1034..d6a16de 100644 --- a/README.md +++ b/README.md @@ -107,11 +107,12 @@ const s3_cli = s3.connect("https://s3.frostfs.devenv:8080") You can also provide additional options: ```js import s3 from 'k6/x/frostfs/s3'; -const s3_cli = s3.connect("https://s3.frostfs.devenv:8080", {'no_verify_ssl': 'true', 'timeout': '60s'}) +const s3_cli = s3.connect("https://s3.frostfs.devenv:8080", {'no_verify_ssl': 'true', 'timeout': '60s', 'aws_profile': 'metal'}) ``` * `no_verify_ss` - Bool. If `true` - skip verifying the s3 certificate chain and host name (useful if s3 uses self-signed certificates) * `timeout` - Duration. Set timeout for requests (in http client). If omitted or zero - timeout is infinite. +* `aws_profile` - String. Use custom profile credentials from `$HOME/.aws/credentials` file. If omitted or empty - use default profile. ### Methods - `createBucket(bucket, params)`. Returns dictionary with `success` boolean flag diff --git a/internal/s3/s3.go b/internal/s3/s3.go index 74d2ccb..f5ef833 100644 --- a/internal/s3/s3.go +++ b/internal/s3/s3.go @@ -59,7 +59,9 @@ func (s *S3) Connect(endpoint string, params map[string]string) (*Client, error) }, nil }) - cfg, err := config.LoadDefaultConfig(s.vu.Context(), config.WithEndpointResolverWithOptions(resolver)) + cfg, err := config.LoadDefaultConfig(s.vu.Context(), + config.WithEndpointResolverWithOptions(resolver), + config.WithSharedConfigProfile(params["aws_profile"])) if err != nil { return nil, fmt.Errorf("configuration error: %w", err) }