Package session provides configuration for the SDK's service clients. Sessionscan be shared across service clients that share the same base configuration.
Sessions are safe to use concurrently as long as the Session is not beingmodified. Sessions should be cached when possible, because creating a newSession will load all configuration values from the environment, and configfiles each time the Session is created. Sharing the Session value across all ofyour service clients will ensure the configuration is loaded the fewest numberof times possible.
By default NewSession will only load credentials from the shared credentialsfile (~/.aws/credentials). If the AWS_SDK_LOAD_CONFIG environment variable isset to a truthy value the Session will be created from the configurationvalues from the shared config (~/.aws/config) and shared credentials(~/.aws/credentials) files. Using the NewSessionWithOptions withSharedConfigState set to SharedConfigEnable will create the session as if theAWS_SDK_LOAD_CONFIG environment variable was set.
The Session will attempt to load configuration and credentials from theenvironment, configuration files, and other credential sources. The orderconfiguration is loaded in is:
The Environment variables for credentials will have precedence over sharedconfig even if SharedConfig is enabled. To override this behavior, and useshared config credentials instead specify the session.Options.Profile, (e.g.when using credential_source=Environment to assume a role).
sess, err := session.NewSessionWithOptions(session.Options{ Profile: "myProfile", })
Creating a Session without additional options will load credentials region, andprofile loaded from the environment and shared config automatically. See,"Environment Variables" section for information on environment variables usedby Session.
// Create Sessionsess, err := session.NewSession()
When creating Sessions optional aws.Config values can be passed in that willoverride the default, or loaded, config values the Session is being createdwith. This allows you to provide additional, or case based, configurationas needed.
// Create a Session with a custom regionsess, err := session.NewSession(&aws.Config{Region: aws.String("us-west-2"),})
Use NewSessionWithOptions to provide additional configuration driving how theSession's configuration will be loaded. Such as, specifying shared configprofile, or override the shared config state, (AWS_SDK_LOAD_CONFIG).
// Equivalent to session.NewSession()sess, err := session.NewSessionWithOptions(session.Options{// Options})sess, err := session.NewSessionWithOptions(session.Options{// Specify profile to load for the session's configProfile: "profile_name",// Provide SDK Config options, such as Region.Config: aws.Config{Region: aws.String("us-west-2"),},// Force enable Shared Config supportSharedConfigState: session.SharedConfigEnable,})
You can add handlers to a session to decorate API operation, (e.g. adding HTTPheaders). All clients that use the Session receive a copy of the Session'shandlers. For example, the following request handler added to the Session logsevery requests made.
// Create a session, and add additional handlers for all service// clients created with the Session to inherit. Adds logging handler.sess := session.Must(session.NewSession())sess.Handlers.Send.PushFront(func(r *request.Request) {// Log every request made and its payloadlogger.Printf("Request: %s/%s, Params: %s",r.ClientInfo.ServiceName, r.Operation, r.Params)})
By default the SDK will only load the shared credentials file's(~/.aws/credentials) credentials values, and all other config is provided bythe environment variables, SDK defaults, and user provided aws.Config values.
If the AWS_SDK_LOAD_CONFIG environment variable is set, or SharedConfigEnableoption is used to create the Session the full shared config values will beloaded. This includes credentials, region, and support for assume role. Inaddition the Session will load its configuration from both the shared configfile (~/.aws/config) and shared credentials file (~/.aws/credentials). Bothfiles have the same format.
If both config files are present the configuration from both files will beread. The Session will be created from configuration values from the sharedcredentials file (~/.aws/credentials) over those in the shared config file(~/.aws/config).
Credentials are the values the SDK uses to authenticating requests with AWSServices. When specified in a file, both aws_access_key_id andaws_secret_access_key must be provided together in the same file to beconsidered valid. They will be ignored if both are not present.aws_session_token is an optional field that can be provided in addition to theother two fields.
aws_access_key_id = AKIDaws_secret_access_key = SECRETaws_session_token = TOKEN; region only supported if SharedConfigEnabled.region = us-east-1
The role_arn field allows you to configure the SDK to assume an IAM role usinga set of credentials from another source. Such as when paired with staticcredentials, "profile_source", "credential_process", or "credential_source"fields. If "role_arn" is provided, a source of credentials must also bespecified, such as "source_profile", "credential_source", or"credential_process".
role_arn = arn:aws:iam::<account_number>:role/<role_name>source_profile = profile_with_credsexternal_id = 1234mfa_serial = <serial or mfa arn>role_session_name = session_name
The SDK supports assuming a role with MFA token. If "mfa_serial" is set, youmust also set the Session Option.AssumeRoleTokenProvider. The Session will failto load if the AssumeRoleTokenProvider is not specified.
sess := session.Must(session.NewSessionWithOptions(session.Options{ AssumeRoleTokenProvider: stscreds.StdinTokenProvider,}))
To setup Assume Role outside of a session see the stscreds.AssumeRoleProviderdocumentation.
When a Session is created several environment variables can be set to adjusthow the SDK functions, and what configuration data it loads when creatingSessions. All environment values are optional, but some values like credentialsrequire multiple of the values to set or the partial values will be ignored.All environment variable values are strings unless otherwise noted.
Environment configuration values. If set both Access Key ID and Secret AccessKey must be provided. Session Token and optionally also be provided, but isnot required.
# Access Key IDAWS_ACCESS_KEY_ID=AKIDAWS_ACCESS_KEY=AKID # only read if AWS_ACCESS_KEY_ID is not set.# Secret Access KeyAWS_SECRET_ACCESS_KEY=SECRETAWS_SECRET_KEY=SECRET=SECRET # only read if AWS_SECRET_ACCESS_KEY is not set.# Session TokenAWS_SESSION_TOKEN=TOKEN
Region value will instruct the SDK where to make service API requests to. If isnot provided in the environment the region must be provided before a serviceclient request is made.
AWS_REGION=us-east-1# AWS_DEFAULT_REGION is only read if AWS_SDK_LOAD_CONFIG is also set,# and AWS_REGION is not also set.AWS_DEFAULT_REGION=us-east-1
Profile name the SDK should load use when loading shared config from theconfiguration files. If not provided "default" will be used as the profile name.
AWS_PROFILE=my_profile# AWS_DEFAULT_PROFILE is only read if AWS_SDK_LOAD_CONFIG is also set,# and AWS_PROFILE is not also set.AWS_DEFAULT_PROFILE=my_profile
SDK load config instructs the SDK to load the shared config in addition toshared credentials. This also expands the configuration loaded so the sharedcredentials will have parity with the shared config file. This also enablesRegion and Profile support for the AWS_DEFAULT_REGION and AWS_DEFAULT_PROFILEenv values as well.
AWS_SDK_LOAD_CONFIG=1
Shared credentials file path can be set to instruct the SDK to use an alternativefile for the shared credentials. If not set the file will be loaded from$HOME/.aws/credentials on Linux/Unix based systems, and%USERPROFILE%\.aws\credentials on Windows.
AWS_SHARED_CREDENTIALS_FILE=$HOME/my_shared_credentials
Shared config file path can be set to instruct the SDK to use an alternativefile for the shared config. If not set the file will be loaded from$HOME/.aws/config on Linux/Unix based systems, and%USERPROFILE%\.aws\config on Windows.
AWS_CONFIG_FILE=$HOME/my_shared_config
Path to a custom Credentials Authority (CA) bundle PEM file that the SDKwill use instead of the default system's root CA bundle. Use this onlyif you want to replace the CA bundle the SDK uses for TLS requests.
AWS_CA_BUNDLE=$HOME/my_custom_ca_bundle
Enabling this option will attempt to merge the Transport into the SDK's HTTPclient. If the client's Transport is not a http.Transport an error will bereturned. If the Transport's TLS config is set this option will cause the SDKto overwrite the Transport's TLS config's RootCAs value. If the CA bundle filecontains multiple certificates all of them will be loaded.
The Session option CustomCABundle is also available when creating sessionsto also enable this feature. CustomCABundle session option field has priorityover the AWS_CA_BUNDLE environment variable, and will be used if both are set.
Setting a custom HTTPClient in the aws.Config options will override this setting.To use this option and custom HTTP client, the HTTP client needs to be providedwhen creating the session. Not the service client.
The SDK supports the environment and session option being configured withClient TLS certificates that are sent as a part of the client's TLS handshakefor client authentication. If used, both Cert and Key values are required. Ifone is missing, or either fail to load the contents of the file an error willbe returned.
HTTP Client's Transport concrete implementation must be a http.Transportor creating the session will fail.
AWS_SDK_GO_CLIENT_TLS_KEY=$HOME/my_client_keyAWS_SDK_GO_CLIENT_TLS_CERT=$HOME/my_client_cert
This can also be configured via the session.Options ClientTLSCert and ClientTLSKey.
sess, err := session.NewSessionWithOptions(session.Options{ClientTLSCert: myCertFile,ClientTLSKey: myKeyFile,})
The endpoint of the EC2 IMDS client can be configured via the environmentvariable, AWS_EC2_METADATA_SERVICE_ENDPOINT when creating the client with aSession. See Options.EC2IMDSEndpoint for more details.
AWS_EC2_METADATA_SERVICE_ENDPOINT=http://169.254.169.254
If using an URL with an IPv6 address literal, the IPv6 addresscomponent must be enclosed in square brackets.
AWS_EC2_METADATA_SERVICE_ENDPOINT=http://[::1]
The custom EC2 IMDS endpoint can also be specified via the Session options.
sess, err := session.NewSessionWithOptions(session.Options{ EC2MetadataEndpoint: "http://[::1]",})
The SDK can be configured to resolve an endpoint with certain capabilities such as FIPS and DualStack.
You can configure a FIPS endpoint using an environment variable, shared config ($HOME/.aws/config),or programmatically.
To configure a FIPS endpoint set the environment variable set the AWS_USE_FIPS_ENDPOINT to true or false to enableor disable FIPS endpoint resolution.
AWS_USE_FIPS_ENDPOINT=true
To configure a FIPS endpoint using shared config, set use_fips_endpoint to true or false to enableor disable FIPS endpoint resolution.
[profile myprofile]region=us-west-2use_fips_endpoint=true
To configure a FIPS endpoint programmatically
// Option 1: Configure it on a session for all clientssess, err := session.NewSessionWithOptions(session.Options{ UseFIPSEndpoint: endpoints.FIPSEndpointStateEnabled,})if err != nil { // handle error}client := s3.New(sess)// Option 2: Configure it per clientsess, err := session.NewSession()if err != nil { // handle error}client := s3.New(sess, &aws.Config{ UseFIPSEndpoint: endpoints.FIPSEndpointStateEnabled,})
You can configure a DualStack endpoint using an environment variable, shared config ($HOME/.aws/config),or programmatically.
To configure a DualStack endpoint set the environment variable set the AWS_USE_DUALSTACK_ENDPOINT to true or false toenable or disable DualStack endpoint resolution.
AWS_USE_DUALSTACK_ENDPOINT=true
To configure a DualStack endpoint using shared config, set use_dualstack_endpoint to true or false to enableor disable DualStack endpoint resolution.
[profile myprofile]region=us-west-2use_dualstack_endpoint=true
To configure a DualStack endpoint programmatically
// Option 1: Configure it on a session for all clientssess, err := session.NewSessionWithOptions(session.Options{ UseDualStackEndpoint: endpoints.DualStackEndpointStateEnabled,})if err != nil { // handle error}client := s3.New(sess)// Option 2: Configure it per clientsess, err := session.NewSession()if err != nil { // handle error}client := s3.New(sess, &aws.Config{ UseDualStackEndpoint: endpoints.DualStackEndpointStateEnabled,})
credentials.gocustom_transport.godoc.goenv_config.gosession.goshared_config.go
In the call graph viewer below, each node is a function belonging to this package and its children are the functions it calls—perhaps dynamically.
The root nodes are the entry points of the package: functions that may be called from outside the package. There may be non-exported or anonymous functions among them if they are called dynamically from another package.
Click a node to visit that function's source code. From there you can visit its callers by clicking its declaringfunc
token.
Functions may be omitted if they were determined to be unreachable in the particular programs or tests that were analyzed.
const (// ErrCodeSharedConfig represents an error that occurs in the shared// configuration logicErrCodeSharedConfig = "SharedConfigErr"// ErrCodeLoadCustomCABundle error code for unable to load custom CA bundle.ErrCodeLoadCustomCABundle = "LoadCustomCABundleError"// ErrCodeLoadClientTLSCert error code for unable to load client TLS// certificate or keyErrCodeLoadClientTLSCert = "LoadClientTLSCertError")
const (// DefaultSharedConfigProfile is the default profile to be used when// loading configuration from the config files if another profile name// is not provided.DefaultSharedConfigProfile = `default`)
constEnvProviderName = "EnvConfigCredentials"
EnvProviderName provides a name of the provider when config is loaded from environment.
varErrSharedConfigECSContainerEnvVarEmpty =awserr.New(ErrCodeSharedConfig, "EcsContainer was specified as the credential_source, but 'AWS_CONTAINER_CREDENTIALS_RELATIVE_URI' was not set", nil)
ErrSharedConfigECSContainerEnvVarEmpty will be returned if the environmentvariables are empty and Environment was set as the credential source
varErrSharedConfigInvalidCredSource =awserr.New(ErrCodeSharedConfig, "credential source values must be EcsContainer, Ec2InstanceMetadata, or Environment", nil)
ErrSharedConfigInvalidCredSource will be returned if an invalid credential source was provided
varErrSharedConfigSourceCollision =awserr.New(ErrCodeSharedConfig, "only one credential type may be specified per profile: source profile, credential source, credential process, web identity token", nil)
ErrSharedConfigSourceCollision will be returned if a section contains bothsource_profile and credential_source
varWebIdentityEmptyRoleARNErr =awserr.New(stscreds.ErrCodeWebIdentity, "role ARN is not set", nil)
WebIdentityEmptyRoleARNErr will occur if 'AWS_WEB_IDENTITY_TOKEN_FILE' was set but'AWS_ROLE_ARN' was not set.
varWebIdentityEmptyTokenFilePathErr =awserr.New(stscreds.ErrCodeWebIdentity, "token file path is not set", nil)
WebIdentityEmptyTokenFilePathErr will occur if 'AWS_ROLE_ARN' was set but'AWS_WEB_IDENTITY_TOKEN_FILE' was not set.
type AssumeRoleTokenProviderNotSetError struct{}
AssumeRoleTokenProviderNotSetError is an error returned when creating asession when the MFAToken option is not set when shared config is configuredload assume a role with an MFA token.
func (eAssumeRoleTokenProviderNotSetError) Code() string
Code is the short id of the error.
func (eAssumeRoleTokenProviderNotSetError) Error() string
Error satisfies the error interface.
func (eAssumeRoleTokenProviderNotSetError) Message() string
Message is the description of the error
func (eAssumeRoleTokenProviderNotSetError) OrigErr() error
OrigErr is the underlying error that caused the failure.
type CredentialRequiresARNError struct {// type of credentials that were configured. Type string// Profile name the credentials were in. Profile string}
CredentialRequiresARNError provides the error for shared config credentialsthat are incorrectly configured in the shared config or credentials file.
func (eCredentialRequiresARNError) Code() string
Code is the short id of the error.
func (eCredentialRequiresARNError) Error() string
Error satisfies the error interface.
func (eCredentialRequiresARNError) Message() string
Message is the description of the error
func (eCredentialRequiresARNError) OrigErr() error
OrigErr is the underlying error that caused the failure.
type CredentialsProviderOptions struct {// WebIdentityRoleProviderOptions configures a WebIdentityRoleProvider,// such as setting its ExpiryWindow. WebIdentityRoleProviderOptions func(*stscreds.WebIdentityRoleProvider)// ProcessProviderOptions configures a ProcessProvider,// such as setting its Timeout. ProcessProviderOptions func(*processcreds.ProcessProvider)}
CredentialsProviderOptions specifies additional options for configuringcredentials providers.
type Options struct {// Provides config values for the SDK to use when creating service clients// and making API requests to services. Any value set in with this field// will override the associated value provided by the SDK defaults,// environment or config files where relevant.//// If not set, configuration values from from SDK defaults, environment,// config will be used. Configaws.Config// Overrides the config profile the Session should be created from. If not// set the value of the environment variable will be loaded (AWS_PROFILE,// or AWS_DEFAULT_PROFILE if the Shared Config is enabled).//// If not set and environment variables are not set the "default"// (DefaultSharedConfigProfile) will be used as the profile to load the// session config from. Profile string// Instructs how the Session will be created based on the AWS_SDK_LOAD_CONFIG// environment variable. By default a Session will be created using the// value provided by the AWS_SDK_LOAD_CONFIG environment variable.//// Setting this value to SharedConfigEnable or SharedConfigDisable// will allow you to override the AWS_SDK_LOAD_CONFIG environment variable// and enable or disable the shared config functionality. SharedConfigState SharedConfigState// Ordered list of files the session will load configuration from.// It will override environment variable AWS_SHARED_CREDENTIALS_FILE, AWS_CONFIG_FILE. SharedConfigFiles []string// When the SDK's shared config is configured to assume a role with MFA// this option is required in order to provide the mechanism that will// retrieve the MFA token. There is no default value for this field. If// it is not set an error will be returned when creating the session.//// This token provider will be called when ever the assumed role's// credentials need to be refreshed. Within the context of service clients// all sharing the same session the SDK will ensure calls to the token// provider are atomic. When sharing a token provider across multiple// sessions additional synchronization logic is needed to ensure the// token providers do not introduce race conditions. It is recommend to// share the session where possible.//// stscreds.StdinTokenProvider is a basic implementation that will prompt// from stdin for the MFA token code.//// This field is only used if the shared configuration is enabled, and// the config enables assume role with MFA via the mfa_serial field. AssumeRoleTokenProvider func() (string, error)// When the SDK's shared config is configured to assume a role this option// may be provided to set the expiry duration of the STS credentials.// Defaults to 15 minutes if not set as documented in the// stscreds.AssumeRoleProvider. AssumeRoleDuration time.Duration// Reader for a custom Credentials Authority (CA) bundle in PEM format that// the SDK will use instead of the default system's root CA bundle. Use this// only if you want to replace the CA bundle the SDK uses for TLS requests.//// HTTP Client's Transport concrete implementation must be a http.Transport// or creating the session will fail.//// If the Transport's TLS config is set this option will cause the SDK// to overwrite the Transport's TLS config's RootCAs value. If the CA// bundle reader contains multiple certificates all of them will be loaded.//// Can also be specified via the environment variable://// AWS_CA_BUNDLE=$HOME/ca_bundle//// Can also be specified via the shared config field://// ca_bundle = $HOME/ca_bundle CustomCABundle io.Reader// Reader for the TLC client certificate that should be used by the SDK's// HTTP transport when making requests. The certificate must be paired with// a TLS client key file. Will be ignored if both are not provided.//// HTTP Client's Transport concrete implementation must be a http.Transport// or creating the session will fail.//// Can also be specified via the environment variable://// AWS_SDK_GO_CLIENT_TLS_CERT=$HOME/my_client_cert ClientTLSCert io.Reader// Reader for the TLC client key that should be used by the SDK's HTTP// transport when making requests. The key must be paired with a TLS client// certificate file. Will be ignored if both are not provided.//// HTTP Client's Transport concrete implementation must be a http.Transport// or creating the session will fail.//// Can also be specified via the environment variable://// AWS_SDK_GO_CLIENT_TLS_KEY=$HOME/my_client_key ClientTLSKey io.Reader// The handlers that the session and all API clients will be created with.// This must be a complete set of handlers. Use the defaults.Handlers()// function to initialize this value before changing the handlers to be// used by the SDK. Handlers request.Handlers// Allows specifying a custom endpoint to be used by the EC2 IMDS client// when making requests to the EC2 IMDS API. The endpoint value should// include the URI scheme. If the scheme is not present it will be defaulted to http.//// If unset, will the EC2 IMDS client will use its default endpoint.//// Can also be specified via the environment variable,// AWS_EC2_METADATA_SERVICE_ENDPOINT.//// AWS_EC2_METADATA_SERVICE_ENDPOINT=http://169.254.169.254//// If using an URL with an IPv6 address literal, the IPv6 address// component must be enclosed in square brackets.//// AWS_EC2_METADATA_SERVICE_ENDPOINT=http://[::1] EC2IMDSEndpoint string// Specifies the EC2 Instance Metadata Service default endpoint selection mode (IPv4 or IPv6)//// AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE=IPv6 EC2IMDSEndpointMode endpoints.EC2IMDSEndpointModeState// Specifies options for creating credential providers.// These are only used if the aws.Config does not already// include credentials. CredentialsProviderOptions *CredentialsProviderOptions}
Options provides the means to control how a Session is created and whatconfiguration values will be loaded.
type Session struct { Config *aws.Config Handlersrequest.Handlers// contains filtered or unexported fields}
A Session provides a central location to create service clients from andstore configurations and request handlers for those services.
Sessions are safe to create service clients concurrently, but it is not safeto mutate the Session concurrently.
The Session satisfies the service client's client.ConfigProvider.
func Must(sess *Session, err error) *Session
Must is a helper function to ensure the Session is valid and there was noerror when calling a NewSession function.
This helper is intended to be used in variable initialization to load theSession and configuration at startup. Such as:
var sess = session.Must(session.NewSession())
func New(cfgs ...*aws.Config) *Session
New creates a new instance of the handlers merging in the provided configson top of the SDK's default configurations. Once the Session is created itcan be mutated to modify the Config or Handlers. The Session is safe to beread concurrently, but it should not be written to concurrently.
If the AWS_SDK_LOAD_CONFIG environment is set to a truthy value, the Newmethod could now encounter an error when loading the configuration. WhenThe environment variable is set, and an error occurs, New will return asession that will fail all requests reporting the error that occurred whileloading the session. Use NewSession to get the error when creating thesession.
If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy valuethe shared config file (~/.aws/config) will also be loaded, in addition tothe shared credentials file (~/.aws/credentials). Values set in both theshared config, and shared credentials will be taken from the sharedcredentials file.
Deprecated: Use NewSession functions to create sessions instead. NewSessionhas the same functionality as New except an error can be returned when thefunc is called instead of waiting to receive an error until a request is made.
func NewSession(cfgs ...*aws.Config) (*Session, error)
NewSession returns a new Session created from SDK defaults, config files,environment, and user provided config files. Once the Session is createdit can be mutated to modify the Config or Handlers. The Session is safe tobe read concurrently, but it should not be written to concurrently.
If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy valuethe shared config file (~/.aws/config) will also be loaded in addition tothe shared credentials file (~/.aws/credentials). Values set in both theshared config, and shared credentials will be taken from the sharedcredentials file. Enabling the Shared Config will also allow the Sessionto be built with retrieving credentials with AssumeRole set in the config.
See the NewSessionWithOptions func for information on how to override orcontrol through code how the Session will be created, such as specifying theconfig profile, and controlling if shared config is enabled or not.
func NewSessionWithOptions(optsOptions) (*Session, error)
NewSessionWithOptions returns a new Session created from SDK defaults, config files,environment, and user provided config files. This func uses the Optionsvalues to configure how the Session is created.
If the AWS_SDK_LOAD_CONFIG environment variable is set to a truthy valuethe shared config file (~/.aws/config) will also be loaded in addition tothe shared credentials file (~/.aws/credentials). Values set in both theshared config, and shared credentials will be taken from the sharedcredentials file. Enabling the Shared Config will also allow the Sessionto be built with retrieving credentials with AssumeRole set in the config.
// Equivalent to session.Newsess := session.Must(session.NewSessionWithOptions(session.Options{}))// Specify profile to load for the session's configsess := session.Must(session.NewSessionWithOptions(session.Options{ Profile: "profile_name",}))// Specify profile for config and region for requestssess := session.Must(session.NewSessionWithOptions(session.Options{ Config: aws.Config{Region: aws.String("us-east-1")}, Profile: "profile_name",}))// Force enable Shared Config supportsess := session.Must(session.NewSessionWithOptions(session.Options{ SharedConfigState: session.SharedConfigEnable,}))
func (s *Session) ClientConfig(service string, cfgs ...*aws.Config) client.Config
ClientConfig satisfies the client.ConfigProvider interface and is used toconfigure the service client instances. Passing the Session to the serviceclient's constructor (New) will use this method to configure the client.
func (s *Session) ClientConfigNoResolveEndpoint(cfgs ...*aws.Config)client.Config
ClientConfigNoResolveEndpoint is the same as ClientConfig with the exceptionthat the EndpointResolver will not be used to resolve the endpoint. The onlyendpoint set must come from the aws.Config.Endpoint field.
func (s *Session) Copy(cfgs ...*aws.Config) *Session
Copy creates and returns a copy of the current Session, copying the configand handlers. If any additional configs are provided they will be mergedon top of the Session's copied config.
// Create a copy of the current Session, configured for the us-west-2 region.sess.Copy(&aws.Config{Region: aws.String("us-west-2")})
type SharedConfigAssumeRoleError struct { RoleARN string SourceProfile string}
SharedConfigAssumeRoleError is an error for the shared config when theprofile contains assume role information, but that information is invalidor not complete.
func (eSharedConfigAssumeRoleError) Code() string
Code is the short id of the error.
func (eSharedConfigAssumeRoleError) Error() string
Error satisfies the error interface.
func (eSharedConfigAssumeRoleError) Message() string
Message is the description of the error
func (eSharedConfigAssumeRoleError) OrigErr() error
OrigErr is the underlying error that caused the failure.
type SharedConfigLoadError struct { Filename string Err error}
SharedConfigLoadError is an error for the shared config file failed to load.
func (eSharedConfigLoadError) Code() string
Code is the short id of the error.
func (eSharedConfigLoadError) Error() string
Error satisfies the error interface.
func (eSharedConfigLoadError) Message() string
Message is the description of the error
func (eSharedConfigLoadError) OrigErr() error
OrigErr is the underlying error that caused the failure.
type SharedConfigProfileNotExistsError struct { Profile string Err error}
SharedConfigProfileNotExistsError is an error for the shared config whenthe profile was not find in the config file.
func (eSharedConfigProfileNotExistsError) Code() string
Code is the short id of the error.
func (eSharedConfigProfileNotExistsError) Error() string
Error satisfies the error interface.
func (eSharedConfigProfileNotExistsError) Message() string
Message is the description of the error
func (eSharedConfigProfileNotExistsError) OrigErr() error
OrigErr is the underlying error that caused the failure.
type SharedConfigState int
SharedConfigState provides the ability to optionally override the stateof the session's creation based on the shared config being enabled ordisabled.
const (// SharedConfigStateFromEnv does not override any state of the// AWS_SDK_LOAD_CONFIG env var. It is the default value of the// SharedConfigState type.SharedConfigStateFromEnvSharedConfigState = iota// SharedConfigDisable overrides the AWS_SDK_LOAD_CONFIG env var value// and disables the shared config functionality. SharedConfigDisable// SharedConfigEnable overrides the AWS_SDK_LOAD_CONFIG env var value// and enables the shared config functionality. SharedConfigEnable)