-
Notifications
You must be signed in to change notification settings - Fork 271
Description
Is your feature request related to a problem?
- Current implementation of
endpointUrlconfigures theawscfgbefore the call tosession.NewSession(). - If you are using oidc, internally
NewSessionwill callstsAssumeRoleWithWebIdentityor if you are using cross account the call tostsAssumeRolewill also occur. - The issue lies in the fact that if one is using a custom endpoint for example to the sagemaker service, when
stsAssumeRoleis called it will throw a 404 as we can no longer reach that service. - This occurs because the
awscfg.Endpointhas been set to the sagemaker endpoint so now we only allow traffic to sagemaker services. As a a result of this the current implementation ofendpointUrldoes not work when the user is using either crossAccount or OIDC roles.
Describe the solution you'd like
-
To use the endpointResolver function as provided by the aws go sdk. Here we can specify when the
service == sagemaker.EndpointsIDto use our custom sagemaker endpoint. -
As a result we are only using this endpoint for sagemaker api calls and we still have access to the
stsAssumeRolecalls. -
To allow for a better user experience instead of having them provide the
service-id.EndpointsIDwe would move this to each resources Manager.go file to create the session and populate this check with the respective service-id and its respectiveEndpointsID. -
To make this change the
aws_resource_manager.gostruct for an AWSResourceManager needs to acceptendpointUrlas well as thegvkand the service controllersVersionInfoso that we can make the injectUserAgent call. -
Then in the manager.go we will create the session and utilize the EndpointResolver func so that EndpointUrl can work when using OIDC and cross account.
-
If the community thinks this is a good solution, I will implement it and get it out for code review
Describe alternatives you've considered
A description of any alternative solutions or features you've considered.
- Have tested all three of these alternatives and they work to resolve this issue however none of them seem to be the best way to resolve things.
-
Make user manually find the endpointsID and pass it in as another variable to the config..... Trying to avoid this with the solution I described above
-
Call
session.NewSession()again after the initial call and grabbing the credentials from the returned session object and then callingsession.NewSession()with those credentials so we don't have to callstsAssumeRole. -
Set
awscfg.Endpointat the end ofnewSessioninstead of at the beginning and Returnawscfgand pass it to the manager.go and call newResourceManager with theawscfgas an additional parameter which will now include the awscfg.Endpoint and will now use this endpoint when creating the service client.