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
AWSTtransformer fromControl.Monad.Trans.AWShas been removed. Functions such assendnow take anEnvas their first argument. You can provide anEnvdirectly, or use whatever transformer or effect system you prefer.The
Credentialsdata 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 formerCredentialsconstructor and it will do the right thing:-- 1.6.1 env <- newEnv Discover -- 2.0 env <- newEnv discoverA 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
Typeableinstances on request/response types. If you write code which is polymorphic across requests and responses, you may need to addTypeable aandTypeable (AWSResponse a)constraints alongside eachAWSRequest aconstraint.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-lensoroptics, possibly with theOverloadedLabelsextension:-- 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.goVersionIdis nowAmazonka.S3.Lens.getObject_versionIdEnums (sum types) are now
newtypewrappers 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-coreandamazonkanow 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; withAWSTgone, it is just a record update
The removal of
AWSTmeans thatNetwork.AWS.Envfunctions which used to operate on anEnvinside aMonadReadernow operate on theEnvdirectly.Serialisation classes like
ToTextandToByteString, and their associated helper functions, are no longer directly exported from moduleAmazonka. If you need these, you may need to importAmazonka.Datadirectly.The interface to the EC2 Instance Metadata Service (IMDS) is no longer exported from the root
Amazonkamodule. If you used this, you should should importAmazonka.EC2.Metadatadirectly.- The functions
Amazonka.dynamic,Amazonka.metadataandAmazonka.userdatahave been removed in favour of their equivalents inAmazonka.EC2.Metadatawhich only require a HTTPManager, not an entireEnv. - If you were using them, read the
manager :: Managerfield 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.