2 All Services
2.1 Names
The names of procedures and structs do not have special prefixes to “group” them. Instead, use the prefix-in option for require if you prefer a prefix (or need one to avoid a name collision).
For example if you want the aws/sns procedures to have an sns- prefix, so that create-topic is renamed to sns-create-topic:
(require (prefix-in sns- aws/sns)) (sns-create-topic "foobar")
2.2 AWS Keys
(require aws/keys) | package: aws |
parameter
(public-key) → string?
(public-key key) → void? key : string?
parameter
(private-key) → string?
(private-key key) → void? key : string?
procedure
file : path? = (build-path(find-system-path 'home-dir) ".aws-keys")
AWSAccessKeyId=<key> |
AWSSecretKey=<key> |
By default this file is ~/.aws-keys. You probably want to chmod the permissions of this file carefully.
procedure
2.3 Exception handling
Most of the functions do not return a failure value. Instead they raise exn:fail:aws, which you need to “catch” using with-handlers.
(require aws/exn) | package: aws |
struct
(struct exn:fail:aws (http-code http-message aws-code aws-message) #:extra-constructor-name make-exn:fail:aws) http-code : exact-positive-integer? http-message : string? aws-code : string? aws-message : string?
procedure
(header&response->exn:fail:aws headers body ccm) → exn:fail:aws? headers : string? body : (or/c bytes? xexpr?) ccm : continuation-mark-set?
procedure
(check-response in headers)
→ (or/c string? (raise/c exn:fail:aws?)) in : input-port? headers : string?
Otherwise, read the XML response body from in and use the information to construct and raise exn:fail:aws.
Note: This does not close the input port in before raising an
exception. It assumes you are using call/requests,
call/input-request, or call/output-request from the
http/request library (or using dynamic-wind or other
exception handling, or a custodian—
2.4 Connection pooling
This library uses the http package to make HTTP connections to AWS. You may cause connections to be reused ("pooled") by setting the current-pool-timeout parameter to some non-zero number of seconds.
This can be faster, especially for many small requests in a row.
In the following example, the first list-buckets request will leave the connection open for 30 seconds. As a result, the second list-buckets request will reuse the same connection. After another 30 seconds, the connection will be closed automatically.
(require http/request aws/s3) (parameterize ([current-pool-timeout 30]) (list-buckets) (list-buckets))