Amazon Web Services Core Functions and Types
Julia

README.md

AWSCore

Amazon Web Services Core Functions and Types.

See seperate modules for service interfaces:

Package Status
AWS S3 Build Status
AWS SQS Build Status
AWS SNS Build Status
AWS IAM Build Status
AWS EC2 Build Status
AWS Lambda Build Status
AWS SES Build Status
AWS SDB Build Status

Build Status

Features

AWS Signature Version 4.

Automatic HTTP request retry with exponential back-off.

Parsing of XML and JSON API error messages to AWSException type.

Automatic API Request retry in case of ExpiredToken or HTTP Redirect.

Configuration

Most AWSCore functions take a configuration object aws as the first argument.

A default configuration can be obtained by calling aws_config(). e.g.:

aws = aws_config()
or
aws = aws_config(region = "ap-southeast-2")

The aws_config() function attempts to load AWS credentials from:

  • EC2 Instance Credentials,
  • AWS Lambda Role Credentials (i.e. env["AWS_ACCESS_KEY_ID"), or
  • ~/.aws/credentials

A ~/.aws/credentials file can be created using the AWS CLI command aws configrue. Or a ~/.aws/credentials file can be created manually:

[default]
aws_access_key_id = AKIAXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

If your ~/.aws/credentials file contains multiple profiles you can select a profile by setting the AWS_DEFAULT_PROFILE environment variable.

aws_config() understands the following AWS CLI environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AWS_DEFAULT_REGION, AWS_DEFAULT_PROFILE and AWS_CONFIG_FILE.

An aws configuration object can also be created directly from a key pair as follows. However, putting access credentials in source code is discouraged.

aws = aws_config(creds = AWSCredentials("AKIAXXXXXXXXXXXXXXXX",
                                        "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"))

Exceptions

May throw: UVError, HTTPException or AWSException.

Examples

Create an S3 bucket and store some data...

s3_create_bucket(aws, "my.bucket")
s3_enable_versioning(aws, "my.bucket")

s3_put(aws, "my.bucket", "key", "Hello!")
println(s3_get(aws, "my.bucket", "key"))

Post a message to a queue...

q = sqs_get_queue(aws, "my-queue")

sqs_send_message(q, "Hello!")

m = sqs_receive_message(q)
println(m["message"])
sqs_delete_message(q, m)

Post a message to a notification topic...

sns_create_topic(aws, "my-topic")
sns_subscribe_sqs(aws, "my-topic", q; raw = true)

sns_publish(aws, "my-topic", "Hello!")

m = sqs_receive_message(q)
println(m["message"])
sqs_delete_message(q, m)

Start an EC2 server and fetch info...

ec2(aws, "StartInstances", {"InstanceId.1" => my_instance_id})
r = ec2(aws, "DescribeInstances", {"Filter.1.Name" => "instance-id",
                                   "Filter.1.Value.1" => my_instance_id})
println(r)

Create an IAM user...

iam(aws, "CreateUser", {"UserName" => "me"})

Get a list of DynamoDB tables...

r = dynamodb(aws, "ListTables", "{}")
println(r)