Amazon Web Services Core Functions and Types.
AWSCore functions take a
AWSConfig dictionary as the first argument. This dictionary holds
AWSCredentials and AWS region configuration.
aws = AWSConfig(:creds => AWSCredentials(), :region => "us-east-1")`
aws_config function provides a simple way to creates an
AWSConfig configuration dictionary.
>aws = aws_config() >aws = aws_config(creds = my_credentials) >aws = aws_config(region = "ap-southeast-2")
By default, the
aws_config attempts to load AWS credentials from:
~/.aws/credentials file can be created using the AWS CLI command
aws configrue. Or it can be created manually:
[default] aws_access_key_id = AKIAXXXXXXXXXXXXXXXX aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
~/.aws/credentials file contains multiple profiles you can select a profile by setting the
AWS_PROFILE environment variable.
aws_config understands the following AWS CLI environment variables:
An configuration dictionary 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"))
Unique Amazon Resource Name for configrued user.
12-digit AWS Account Number.
AWS Security Credentials
When you interact with AWS, you specify your AWS Security Credentials to verify who you are and whether you have permission to access the resources that you are requesting. AWS uses the security credentials to authenticate and authorize your requests.
secret_key hold the access keys used to authenticate API requests (see Creating, Modifying, and Viewing Access Keys).
Temporary Security Credentials require the extra session
AWSCredentials() constructor tries to load local Credentials from environment variables,
~/.aws/credentials or EC2 instance credentials.
Load Credentials from environment variables
AWS_SECRET_ACCESS_KEY etc. (e.g. in Lambda sandbox).
Load Credentials from AWS CLI ~/.aws/credentials file.
Load Instance Profile Credentials for EC2 virtual machine.
Endpoints and Resource Names
aws_endpoint(service, [region, [hostname_prefix]])
Generate service endpoint URL for
arn([::AWSConfig], service, resource, [region, [account]])
Generate an Amazon Resource Name for
AWSCore.arn("sqs", "au-test-queue", "ap-southeast-2", "1234")
AWSCore.arn(default_aws_config(), "sns", "au-test-topic")
Extract region name from
AWSRequest do_request dump_aws_request post_request
post_request(aws_config(), "sdb", "2009-04-15", Dict("Action" => "ListDomains"))
Is Julia running in an AWS Lambda sandbox?
Is Julia running on an EC2 virtual machine?
Fetch EC2 meta-data for
parts as a MIME Multipart message.
parts is a Vector of
(filename, content_type, content) Tuples.
println(AWSCore.mime_multipart([ ("foo.txt", "text/plain", "foo"), ("bar.txt", "text/plain", "bar") ]))
MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=PRZLn8Nm1I82df0Dtj4ZvJi=" --=PRZLn8Nm1I82df0Dtj4ZvJi= Content-Type: text/plain; name=foo.txt Content-Disposition: attachment; filename=foo.txt Content-Transfer-Encoding: binary foo --=PRZLn8Nm1I82df0Dtj4ZvJi= Content-Type: text/plain; name=bar.txt Content-Disposition: attachment; filename=bar.txt Content-Transfer-Encoding: binary bar --=PRZLn8Nm1I82df0Dtj4ZvJi=--