| Copyright | (c) 2013-2023 Brendan Hay |
|---|---|
| License | Mozilla Public License, v. 2.0. |
| Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
| Stability | provisional |
| Portability | non-portable (GHC extensions) |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Amazonka.Auth.ConfigFile
Description
Retrieve authentication credentials from AWS config/credentials files.
Synopsis
- fromFilePath :: forall m withAuth. (MonadIO m, Foldable withAuth) => Text -> FilePath -> FilePath -> Env' withAuth -> m Env
- mergeConfigs :: HashMap Text [(Text, Text)] -> HashMap Text [(Text, Text)] -> HashMap Text (HashMap Text Text)
- parseConfigProfile :: HashMap Text Text -> Maybe (ConfigProfile, Maybe Region)
- data ConfigProfile
- data CredentialSource
- fromFileEnv :: (MonadIO m, Foldable withAuth) => Env' withAuth -> m Env
- configPathRelative :: String -> IO String
Documentation
Arguments
| :: forall m withAuth. (MonadIO m, Foldable withAuth) | |
| => Text | Profile name |
| -> FilePath | Credentials file |
| -> FilePath | Config file |
| -> Env' withAuth | |
| -> m Env |
Retrieve credentials from the AWS config/credentials files, as Amazonka currently understands them:
- AWS recommends credentials do not live in the config file, but allows it.
- Sections in the config file start should either be named
[default]or[profile foo]. Unprefixed[foo]currently "happens to work" but is not officially supported, to match the observed behaviour of the AWS SDK/CLI. - Sections in the credentials file are always unprefixed -
[default]or[foo].
See: the ConfigProfile type, to understand the methods Amazonka
currently supports.
parseConfigProfile :: HashMap Text Text -> Maybe (ConfigProfile, Maybe Region) Source #
data ConfigProfile Source #
Constructors
| ExplicitKeys AuthEnv | Recognizes |
| AssumeRoleFromProfile Text Text | Recognizes |
| AssumeRoleFromCredentialSource Text CredentialSource | Recognizes |
| AssumeRoleWithWebIdentity Text (Maybe Text) FilePath | Recognizes |
| AssumeRoleViaSSO Text Region Text Text | Recognizes |
Instances
data CredentialSource Source #
Constructors
| Environment | |
| Ec2InstanceMetadata | |
| EcsContainer |
Instances
fromFileEnv :: (MonadIO m, Foldable withAuth) => Env' withAuth -> m Env Source #
Loads the default config/credentials INI files and selects a
profile by environment variable (AWS_PROFILE).
Throws MissingFileError if credFile is missing, or InvalidFileError
if an error occurs during parsing.
This looks in in the HOME directory as determined by the
directory library.
- Not Windows:
$HOME/.aws/credentials - Windows:
%USERPROFILE%\.aws\credentials