Closed dideler closed 6 years ago
Running the AWS CLI command above with --debug
shows a different authorisation value.
Elixir service
Credential=HASH/DATE/REGION/runtime.sagemaker/aws4_request
AWS CLI
Credential=HASH/DATE/REGION/sagemaker/aws4_request
Note that the service name in ExAws.SageMakerRuntime
is :"runtime.sagemaker"
instead of :sagemaker
, as SageMaker Runtime is a separate service from SageMaker.
References that treat SageMaker and SageMaker Runtime as separate services
I tried with :sagemaker
as the service name but then it makes the request to the wrong service, and returns an UnknownOperationException
.
There's at least one other service with this condition: lex vs runtime.lex
We can set a default credential scope for the runtime.sagemaker
service in priv/endpoints.ex
.
"runtime.sagemaker" => %{
+ "defaults" => %{"credentialScope" => %{"service" => "sagemaker"}},
"endpoints" => %{
"ap-northeast-1" => %{},
"eu-west-1" => %{},
"us-east-1" => %{},
"us-east-2" => %{},
"us-west-2" => %{}
}
},
I noticed some of the other services in this file do the same. But the value is currently being ignored.
I'll open some PRs to update runtime.sagemaker
and for auth to consider a default credentialScope
.
Environment
Elixir 1.6.2 (compiled with OTP 20)
ex_aws 2.1.0 (Hex package) (mix) locked at 2.1.0 (ex_aws) b9265152
HTTP client version. IE for hackney do
mix deps | grep hackney
hackney 1.14.3 (Hex package) (rebar3) locked at 1.14.3 (hackney) b5f6f5dc
Current behavior
I'm writing a service for SageMaker Runtime
Configured as
The request returns a 403 "Credential should be scoped to correct service: 'sagemaker'"
Expected behavior
The signed request returns a 200.
Credentials don't seem to be the problem as it works when using AWS CLI
Found a similar issue, but it goes over my head: https://github.com/aws/aws-sdk-go/issues/1836