I have an issue with global_aws_config. It works perfectly fine in SageMaker Notebook:
aws = global_aws_config(; region="us-west-2")
AWSConfig(arn:aws:iam::123456789:instance-profile/BaseNotebookInstanceEc2InstanceRole
(STUFFSTUFFSTUFF, +ST..., STU..., 2021-10-13T08:03:03), "us-west-2", "json")
but when running the same line of code in SageMaker Studio:
aws = global_aws_config(; region="us-west-2")
KeyError: key "RoleArn" not found
Stacktrace:
[1] getindex(h::Dict{String, Any}, key::String)
@ Base ./dict.jl:482
[2] ecs_instance_credentials()
@ AWS /opt/julia/packages/AWS/RCBqC/src/AWSCredentials.jl:338
[3] AWSCredentials(; profile::Nothing, throw_cred_error::Bool)
@ AWS /opt/julia/packages/AWS/RCBqC/src/AWSCredentials.jl:126
[4] #global_aws_config#53
@ /opt/julia/packages/AWS/RCBqC/src/AWS.jl:78 [inlined]
[5] top-level scope
@ In[14]:2
[6] eval
@ ./boot.jl:360 [inlined]
[7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1116
Has anyone else had issue with AWS.jl package and using the aws_config / global_aws_config? I read in the AWS.jl documentation that you can create a text file for it to check but it doesn’t provide an example or much information on how the file is supposed to be structured or where it needs to be placed.
I have tried specifying the ARN within the aws_config:
aws = global_aws_config(creds = AWSCredentials(user_arn = "arn:aws:iam::123456789:role/service-
role/stuffstuffstuff"), region = "us-west-2")
but this just spits out an error:
MethodError: no method matching AWSCredentials(; user_arn="arn:aws:iam::123456789:role/service-
role/stuffstuffstuff")
Closest candidates are:
AWSCredentials(; profile, throw_cred_error) at
/opt/julia/packages/AWS/RCBqC/src/AWSCredentials.jl:107 got unsupported keyword argument "user_arn"
AWSCredentials(::Any, ::Any) at /opt/julia/packages/AWS/RCBqC/src/AWSCredentials.jl:71 got
unsupported keyword argument "user_arn"
AWSCredentials(::Any, ::Any, ::Any) at /opt/julia/packages/AWS/RCBqC/src/AWSCredentials.jl:71 got
unsupported keyword argument "user_arn"
...
Stacktrace:
[1] kwerr(kw::NamedTuple{(:user_arn,), Tuple{String}}, args::Type)
@ Base ./error.jl:157
[2] top-level scope
@ In[16]:1
[3] eval
@ ./boot.jl:360 [inlined]
[4] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
@ Base ./loading.jl:1116
I don’t know why user_arn is not supported because that is the text used when I check
?AWSCredentials
it shows:
AWSCredentials
When you interact with AWS, you specify your AWS Security Credentials to verify who you are and
whether you have permission to access the resources that you are requesting. AWS uses the security
credentials to authenticate and authorize your requests. The fields access_key_id and secret_key hold
the access keys used to authenticate API requests (see Creating, Modifying, and Viewing Access
Keys). Temporary Security Credentials require the extra session token field. The user_arn and
account_number fields are used to cache the result of the aws_user_arn and aws_account_number
functions.
AWS.jl searches for credentials in a series of possible locations and stops as soon as it finds
credentials. The order of precedence for this search is as follows:
Passing credentials directly to the AWSCredentials constructor
Environment variables
Shared credential file (~/.aws/credentials)
AWS config file (~/.aws/config)
Assume Role provider via the aws config file
Instance metadata service on an Amazon EC2 instance that has an IAM role configured
Once the credentials are found, the method by which they were accessed is stored in the renew field
and the DateTime at which they will expire is stored in the expiry field. This allows the credentials to be
refreshed as needed using check_credentials. If renew is set to nothing, no attempt will be made to
refresh the credentials. Any renewal function is expected to return nothing on failure or a populated
AWSCredentials object on success. The renew field of the returned AWSCredentials will be discarded
and does not need to be set.
To specify the profile to use from ~/.aws/credentials, do, for example, AWSCredentials(profile="profile-
name").
Any help or direction will be appreciated!