Comprehensive Amazon Web Services SDK.
This client library contains request and response logic to communicate with Amazon Web Service compatible APIs using the types supplied by the various amazonka-*
service libraries. See the AWS category on Hackage for supported services.
To get started, import Amazonka
and the desired amazonka-*
library (such as Amazonka.MachineLearning)
GHC 8.10.7 and higher is officially supported.
Amazonka
Description
Client library containing request and response logic to communicate with Amazon Web Service compatible APIs. Intended to be used alongside the types supplied by the various amazonka-*
service libraries.
Migrating from 1.6.1 to 2.0
CHANGELOG.md
is extremely thorough, but these notes should get you started:
Modules have been moved from
Network.AWS.*
toAmazonka.*
. Perform a find/replace on your import statements, e.g.:perl -pi -e 's/Network\.AWS/Amazonka/g' `find . -type f -name '*.hs'`
The
AWST
transformer fromControl.Monad.Trans.AWS
has been removed. Functions such assend
now take anEnv
as their first argument. You can provide anEnv
directly, or use whatever transformer or effect system you prefer.The
Credentials
data type no longer exists. Credential discovery methods are now represented as functions of typeEnvNoAuth -> m Env
, and common ones are exported fromAmazonka.Auth
. In most cases you can downcase the first character of a formerCredentials
constructor and it will do the right thing:-- 1.6.1 env <- newEnv Discover -- 2.0 env <- newEnv discover
A full list of new credential providers and their 1.6.1 equivalents, if any, are listed under the "Major Changes" heading of the 2.0 RC 2 section of
CHANGELOG.md
.On Windows, the {credential,config} files are read from
%USERPROFILE%\.aws\{credentials,config}
to match the AWS SDK.Many Amazonka functions now require
Typeable
instances on request/response types. If you write code which is polymorphic across requests and responses, you may need to addTypeable a
andTypeable (AWSResponse a)
constraints alongside eachAWSRequest a
constraint.Request/response data types have been simplified:
Data type smart constructors are prefixed with
new
. Example:Network.AWS.S3.getObject
->Amazonka.S3.newGetObject
.All generated types export their constructors, which are always the "primed" name of the base type. Example:
data GetObject = GetObject' { ... }
.Records also export all their fields, which no longer have any prefix.
The recommended way to fill in additional record fields is to use a library such as
generic-lens
oroptics
, possibly with theOverloadedLabels
extension:-- 1.6.1 import Network.AWS.S3 let req = getObject "my-bucket" "/foo/bar.txt" & goVersionId ?~ "some-version" -- 2.0 {-# LANGUAGE OverloadedLabels #-} import Amazonka.S3 import Control.Lens ((?~)) import Data.Generics.Labels () let req = newGetObject "my-bucket" "/foo/bar.txt" & #versionId ?~ "some-version"
Generated lenses are still available, but no longer use heuristic abbreviations. Example:
Network.AWS.S3.goVersionId
is nowAmazonka.S3.Lens.getObject_versionId
Enums (sum types) are now
newtype
wrappers overText
. "Constructors" for these enums are provided as "bundled" pattern synonyms, but other values are permitted. This is especially useful for new EC2 instance types or new AWS region names. As with generated lens names, the type name is baked into the pattern synonym. Example:InstanceType_R4_8xlarge
.
All hand-written records in
amazonka-core
andamazonka
now follow the conventions set by generated records: no leading underscores and no inconsistent prefixing of fields. As part of this, some functions were renamed or removed:Amazonka.Env.configure
->Amazonka.Env.configureService
(and its re-export fromAmazonka
)Amazonka.Env.override
->Amazonka.Env.overrideService
(and its re-export fromAmazonka
)Amazonka.Env.timeout
->Amazonka.Env.globalTimeout
(and its re-export fromAmazonka
)Amazonka.Env.within
: removed; withAWST
gone, it is just a record update
The removal of
AWST
means thatNetwork.AWS.Env
functions which used to operate on anEnv
inside aMonadReader
now operate on theEnv
directly.Serialisation classes like
ToText
andToByteString
, and their associated helper functions, are no longer directly exported from moduleAmazonka
. If you need these, you may need to importAmazonka.Data
directly.The interface to the EC2 Instance Metadata Service (IMDS) is no longer exported from the root
Amazonka
module. If you used this, you should should importAmazonka.EC2.Metadata
directly.- The functions
Amazonka.dynamic
,Amazonka.metadata
andAmazonka.userdata
have been removed in favour of their equivalents inAmazonka.EC2.Metadata
which only require a HTTPManager
, not an entireEnv
. - If you were using them, read the
manager :: Manager
field directly from yourEnv
.
- The functions
Contribute
For any problems, comments, or feedback please create an issue here on GitHub.
Licence
amazonka
is released under the Mozilla Public License Version 2.0.