Giter Club home page Giter Club logo

aws.jl's Introduction

AWS.jl

CI Code Style: Blue ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

Docs: stable Docs: dev

Overview

A Julia interface for Amazon Web Services.

This package replaces AWSCore.jl and AWSSDK.jl which previously provided low-level and high-level APIs respectively. It includes automated code generation to ensure all new AWS services are available, as well as keeping existing services up to date.

semver note: AWS.jl uses semver to imbue it's version numbers with semantic meaning. In particular, breaking changes to the programmatic interface provided by AWS.jl (e.g. the @service macro, the backends mechanism, etc) will only occur when the major version number changes. However, breaking changes to the upstream AWS-provided API are not reflected in the AWS.jl version number. For example, if AWS removes functionality, changes a keyword argument, etc, then the corresponding changes will be made here (via an automated update mechanism) without a corresponding breaking release to AWS.jl. These changes will always be made as a feature release, i.e. a minor-version bump to AWS.jl. Therefore it is recommended to use the tilde specifier in your compat bounds with AWS.jl if your code is sensitive to such changes.

To see an overview of the architecture see the design document.

Installation

julia> Pkg.add("AWS")

Usage

AWS.jl can be used with low-level and high-level API requests. Please note when passing parameters for a request they must be a subtype of AbstractDict{String, <:Any}.

Low-Level

To use the low-level API, you must know how to perform the request you are making. If you do not know how to perform a request you can reference the AWS Documentation. Alternatively you can look at /src/services/{Service}.jl to find a list of available requests, as well as their required and optional parameters.

For example, to list the objects in an S3 bucket you must pass in the request method ("GET") and the endpoint ("/${bucket}"):

using AWS.AWSServices: s3

s3("GET", "/your-bucket")

High-Level

To use the high-level API, you only need to know the name of the request you wish to make. For example again, to list the objects in an S3 bucket:

using AWS: @service
@service S3

S3.list_objects("your-bucket") # note: no '/' in front of bucket name

Working with public buckets that require "--no-sign-request", e.g. copernicus data, you'll need to set AWS credentials to nothing:

using AWS: @service
@service S3

aws_config = AWSConfig(; creds=nothing, region="eu-central-1")
a = S3.list_objects("copernicus-dem-30m/"; aws_config)

The high-level function calls are wrapped around the low-level function calls, meaning you can still pass along any low-level kwargs such as aws_config when making these requests.

Note: When calling the @service macro you CANNOT match the predefined constant for the low level API. The low level API constants are named in all lowercase, and spaces are replaced with underscores.

using AWS.AWSServices: secrets_manager
using AWS: @service

# This matches the constant and will error!
@service secrets_manager
> ERROR: cannot assign a value to variable AWSServices.secrets_manager from module Main

# This does NOT match the filename structure and will error!
@service secretsmanager
> ERROR: could not open file /.julia/dev/AWS.jl/src/services/secretsmanager.jl

# All of the examples below are valid!
@service Secrets_Manager
@service SECRETS_MANAGER
@service sECRETS_MANAGER

Limitations

Currently there are a few limitations with the high-level APIs. For example, with S3's DeleteMultipleObjects call. To remove multiple objects you must pass in an XML string (see below) in the body of the request.

Low-Level API Example:

using AWS.AWSServices: s3

body = """
    <Delete xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
        <Object>
            <Key>test.txt</Key>
        </Object>
    </Delete>
    """
bucket_name = "example-bucket"

s3("POST", "/$bucket_name?delete", Dict("body" => body))  # Delete multiple objects

There is no-programatic way to see this from the aws-sdk-js, so the high-level function will not work.

High-Level API Example:

using AWS: @service
@service S3

body = """
    <Delete xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
        <Object>
            <Key>test.txt</Key>
        </Object>
    </Delete>
    """
bucket_name = "example-bucket"

S3.DeleteObjects(bucket_name, body)  # Delete multiple objects
> ERROR: AWS.AWSExceptions.AWSException("MissingRequestBodyError", "Request Body is empty")

There are most likely other similar functions which require more intricate details in how the requests are performed, both in the S3 definitions and in other services.

Modifying Functionality

There are sometimes situations, in which default behavior of AWS.jl might be overridden, for example when this package is used to access S3-compatible object storage of a different cloud service provider, which might have different ways of joining the endpoint url, encoding the region in the signature etc. In many cases this can be achieved by creating a user-defined subtype of AbstractAWSConfig where some of the default methods are overwritten. For example, if you want to use the S3 high-level interface to access public data from GCS without authorisation, you could define:

struct AnonymousGCS <:AbstractAWSConfig end
struct NoCredentials end
AWS.region(aws::AnonymousGCS) = "" # No region
AWS.credentials(aws::AnonymousGCS) = NoCredentials() # No credentials
AWS.check_credentials(c::NoCredentials) = c # Skip credentials check
AWS.sign!(aws::AnonymousGCS, ::AWS.Request) = nothing # Don't sign request
function AWS.generate_service_url(aws::AnonymousGCS, service::String, resource::String)
    service == "s3" || throw(ArgumentError("Can only handle s3 requests to GCS"))
    return string("https://storage.googleapis.com.", resource)
end
AWS.global_aws_config(AnonymousGCS())

which skips some of the signature and credentials checking and modifies the generation of the endpoint url. A more extended example would be to use this package to access a custom minio server, we can define:

struct MinioConfig <: AbstractAWSConfig
   endpoint::String
   region::String
   creds
end
AWS.region(c::MinioConfig) = c.region
AWS.credentials(c::MinioConfig) = c.creds

and we define our own credentials type:

struct SimpleCredentials
    access_key_id::String
    secret_key::String
    token::String
end
AWS.check_credentials(c::SimpleCredentials) = c

as well as a custom url generator:

function AWS.generate_service_url(aws::MinioConfig, service::String, resource::String)
    service == "s3" || throw(ArgumentError("Can only handle s3 requests to Minio"))
    return string(aws.endpoint, resource)
end
AWS.global_aws_config(MinioConfig("http://127.0.0.1:9000", "aregion", SimpleCredentials("minio", "minio123", "")))

Now we are ready to use AWS.jl to do S3-compatible requests to a minio server.

Alternative Solutions

There are a few alternatives to this package, the two below are being deprecated in favour of this package:

As well as some hand-written packages for specific AWS services:

aws.jl's People

Contributors

amitmurthy avatar ararslan avatar bors[bot] avatar c42f avatar christopher-dg avatar cole-p avatar ericphanson avatar expandingman avatar github-actions[bot] avatar hoyttyoh avatar iamed2 avatar ianbutterworth avatar jackdunnnz avatar jingpengw avatar keno avatar kleinschmidt avatar laborg avatar mattbrzezinski avatar mdpradeep avatar merl-dev avatar mortenpi avatar nickrobinson251 avatar octogonapus avatar omus avatar quinnj avatar s2maki avatar sean-bennett112 avatar staticfloat avatar tanmaykm avatar zot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aws.jl's Issues

What is the proper way to upload a file?

Thank you for this library!
What is the proper way to upload a file?

It looks like https://github.com/JuliaParallel/AWS.jl/blob/master/src/S3.jl#L518
should allow specification of data to be of IO.

However it looks like when do_http is called, it passes the IO directly to Requests.put
https://github.com/JuliaParallel/AWS.jl/blob/master/src/S3.jl#L730

The requests library doesn't seem to support uploading files using PUT, only POST with parameter type FileParam https://github.com/JuliaWeb/Requests.jl#file-upload

Is there an easy way to upload files?

Launching into instance types requiring a VPC, for EC2

First, many thanks for the code. I have successfully performed Julia parallel processing on EC2, using the EC2 Simple API.

When trying to launch c4 or m4 instances types, however, I received the following error message regarding launching into a VPC. This was received after attempting the ec2_launch command:

HTTPCode: 400
Headers: Dict{AbstractString,AbstractString}("Transfer-Encoding"=>"chunked","Connection"=>"close","http_major"=>"1","Date"=>"Thu, 14 Jul 2016 22:07:55 GMT","http_minor"=>"1","Keep-Alive"=>"0","Server"=>"AmazonEC2","status_code"=>"400")
Body : <?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>VPCResourceNotSpecified</Code><Message>The specified instance type can only be used in a VPC. A subnet ID or network interface ID is required to carry out the request.</Message></Error></Errors><RequestID>04402b75-f712-45d2-adf1-35c068954f4f</RequestID></Response>
ERROR: LoadError: code: VPCResourceNotSpecified, msg : The specified instance type can only be used in a VPC. A subnet ID or network interface ID is required to carry out the request., 04402b75-f712-45d2-adf1-35c068954f4f
 in error at ./error.jl:21
 in ec2_launch at /home/ubuntu/.julia/v0.4/AWS/src/ec2_simple.jl:80
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:320
 in process_options at ./client.jl:280
 in _start at ./client.jl:378
while loading /home/ubuntu/aws_test_with_exp_cf-exp.jl, in expression starting on line 15

Is it possibly to add a subnet id argument to the ec2_launch command, in order to launch instance types that require a VPC? Many thanks.

Have something like an AWSUserConfig type?

It would be nice to have an AWSUserConfig type, where I can instantiate it with my user name, key, and any other information needed to identify me for purposes of using AWS stuff.

Using AWS.jl to connect NOT to AmazonS3

We have set up a local endpoint on a server here using S3 storage. I am currently trying to connect to it, setting the ep to the server url (like https://s3-test.myhost.net) and setting the correct access and secret key. Yet, I just get the result that the access key is unknown and apparently the responding server was again AmazonS3. Is there any way of not directing the request to amazon? The following is what I tried:

using AWS
using AWS.S3

env = AWSEnv(id="XXXXXXXXXXXXX",
            key="XXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
            ep="https://s3-test.myhost.net")

S3.list_all_buckets(env)

What finally results in this:

S3Response
content_length: 0
date: Wed, 21 Feb 2018 14:38:20 GMT
server: AmazonS3
eTag:
http_code: 403
delete_marker: false
id_2:
request_id:
version_id:
headers: Pair{String,String} Dict
    Transfer-Encoding => chunked
    status_code => 403
    http_major => 1
    x-amz-request-id => XXXXXXXXXXXXX
    Content-Type => application/xml
    Date => Wed, 21 Feb 2018 14:38:20 GMT
    http_minor => 1
    Keep-Alive => 1
    Server => AmazonS3
    x-amz-id-2 => XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=
obj: AWS.S3.S3Error("InvalidAccessKeyId", "The AWS Access Key Id you provided does not exist in our records.", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=", "XXXXXXXXXXXXX")
pd: Not set

Thank you a lot in advance for your help!

0.6 syntax deprecations

julia> using AWS
INFO: Precompiling module AWS.

WARNING: deprecated syntax "typealias $fake_t $real_t" at /Users/evalentiner/.julia/v0.6/AWS/src/crypto.jl:13.
Use "$fake_t = $real_t" instead.

WARNING: deprecated syntax "typealias size_t Csize_t" at /Users/evalentiner/.julia/v0.6/AWS/src/crypto.jl:22.
Use "const size_t = Csize_t" instead.
use default region: us-east-1

segfault on S3.get_object

I'm not quite sure how to debug this one

import AWS, AWS.S3
e = AWSEnv()
AWS.S3.get_bkt_location("teapot")

signal (11): Segmentation fault: 11
pthread_mutex_lock at /usr/lib/system/libsystem_pthread.dylib (unknown line)
Segmentation fault: 11

The bucket in question allows public access. Are there diagnostics that could tell me what's going on?

sample session: can't launch

hi
i've tried to reproduce the sample session. I get as far as

➜  sample git:(master) julia launch.jl
Launched instances : 
ASCIIString["i-96866411"]
Tagged instances
Status of i-96866411 is 0:pending
All instances not yet in a running state. Trying again in 5.0 seconds....
Status of i-96866411 is 0:pending
All instances not yet in a running state. Trying again in 5.0 seconds....
Status of i-96866411 is 0:pending
All instances not yet in a running state. Trying again in 5.0 seconds....
Status of i-96866411 is 0:pending
All instances not yet in a running state. Trying again in 5.0 seconds....
Status of i-96866411 is 16:running
Testing TCP connects (on port 22) to all newly started hosts...
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
Some newly started hosts are still unreachable. Trying again in 2.0 seconds.
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
Some newly started hosts are still unreachable. Trying again in 2.0 seconds.
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
Some newly started hosts are still unreachable. Trying again in 2.0 seconds.
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
Some newly started hosts are still unreachable. Trying again in 2.0 seconds.
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
Some newly started hosts are still unreachable. Trying again in 2.0 seconds.
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
Some newly started hosts are still unreachable. Trying again in 2.0 seconds.
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
Some newly started hosts are still unreachable. Trying again in 2.0 seconds.
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
Some newly started hosts are still unreachable. Trying again in 2.0 seconds.
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
Some newly started hosts are still unreachable. Trying again in 2.0 seconds.
Testing connection to ec2-54-86-39-139.compute-1.amazonaws.com
...

and this goes on forever. I can see one node running on my aws console, but that's it. I can start any number of nodes with this machine and account setting via StarCluster, for example, or directly on the AWS console. my config.jl is

# "ami-ab8190c2" is a Julia pre-installed public AMI 
# "ami-7bccd012" is a bare Ubuntu image. The latest Julia and its dependencies 
# will be installed.

const PVM_AMI_UBUNTU_1310_US_EAST = "ami-7bccd012"
const HVM_AMI_UBUNTU_1310_US_EAST = "ami-73ccd01a"

ec2_ami = PVM_AMI_UBUNTU_1310_US_EAST
ec2_install_julia = true
ec2_sshkey = "virginia"
ec2_sshkey_file = "/Users/florian.oswald/.ssh/virginia.pem"
ec2_insttype = "t1.micro"
ec2_instnum = 1
ec2_workers_per_instance = 0
ec2_num_workers = 2
ec2_julia_dir = "/home/ubuntu/julia/usr/bin" 
ec2_clustername = "mycluster"

any ideas?

can not get credential information

the function of get_instance_credentials do not work for me. I test it inside an instance, nothing returned.

There is no credential information in the server:

curl http://169.254.169.254/latest/meta-data/
ami-id
ami-launch-index
ami-manifest-path
block-device-mapping/
hostname
iam/
instance-action
instance-id
instance-type
local-hostname
local-ipv4
mac
metrics/
network/
placement/
profile
public-hostname
public-ipv4
public-keys/
reservation-id
security-groups
services/

BTW, isn't the 2014-11-05 here should be latest?
https://github.com/JuliaParallel/AWS.jl/blob/master/src/AWS.jl#L167

Reading of ~/.awssecret

It would be nice to be able to automatically read in ~/.awssecret to get the key and ID if not supplied in the code. (Not sure how you would want to architect this; perhaps make key and id optional, or attempt to read in the ~/.awssecret file if they are passed in as None?)

Convenience function for .obj in S3.get_object

Thanks for putting together this package Amit, it's been working pretty well on my S3 goofing around tonight.

As I played with the S3.get_object file to download a .csv file, I found myself needing to parse out the String object that is returned. Since I believe that downloading text data files will be a likely use of this package, it'd be great to be able to parse text files into arrays/DataFrames automatically.

Here's the flow I did:

resp = S3.get_object(env, "rzwitch/julia-test", "urls_10000.wsv");
#this splits on the newline character, which is enough in this toy case since I have a single column
url_array = split(resp.obj, "\n",-1,false) 
#Convert to DataFrame
testdf = DataFrame(url_array)

Alternatively, this could be suggested for the DataFrames package to deal with strings explicitly; I tried the DataStream function, but that didn't seem to work.

cc: @johnmyleswhite

ERROR: InitError: invalid redefinition of constant AWS_ID

on release 0.5:

ERROR: InitError: invalid redefinition of constant AWS_ID
 in __init__() at /Users/florian.oswald/.julia/v0.5/AWS/src/AWS.jl:48
 in _include_from_serialized(::String) at ./loading.jl:150
 in _require_from_serialized(::Int64, ::Symbol, ::String, ::Bool) at ./loading.jl:187
 in require(::Symbol) at ./loading.jl:423
 in require(::Symbol) at /Applications/Julia-0.5.app/Contents/Resources/julia/lib/julia/sys.dylib:?
during initialization of module AWS```

Adding back region-aware S3 request

Hello All,
I am starting to experiment with this package, as I am interested in SQS and S3. Living in Europe, it is vital for me to access eu-west-1 region. Nevertheless it does not work by default, because in function do_http() in S3.jl on line 684 someone has commented
`

region specific URL is not required

## if( isempty(env.region) )
	url = "https://s3.amazonaws.com" * full_path
## else
	## url = "https://s3-$(env.region).amazonaws.com" * full_path
## end

`
Can someone uncomment >

I do not know the state of this package, because even transfer to 0.5 seems to be unfinished, as there are lots of warnings, even though in pull requests I see that someone has fixed the warning.

A suggestion regarding API generation

I have been using a botocore wrapper in Julia using PyCall.jl for the last 6 months or so with zero issues. Digging through the boto3 library I discovered a json api definitions for almost every AWS API. Would it not be best to build the julia interface using these json defs? They seem to kept up to date.

hmacsha256_digest problem ?

Thank you for this nice package.

When I run julia launch.jl I obtain:

ERROR: LoadError: MethodError: `hmacsha256_digest` has no method matching hmacsha256_digest(::ASCIIString, ::SubString{ASCIIString})
Closest candidates are:
  hmacsha256_digest(::AbstractString, !Matched::Union{ASCIIString,Array{UInt8,1}})

Thank you for your help.

precompiling uses env vars from compile-time, not run-time

In src/AWS.jl, lines 35-59 refer to environment variables in order to set up credentials. Since those lines are in open code, the variables will be initialized based on ENV at precompile time rather than when the package gets used.

Recommend this code get moved into init, and the rest of the package get scanned visually for other similar problems.

Support for dynamodb?

Do you guys plan on supporting dynamodb at some point? It's certainly no hurry on my part, but wanted to see what the thoughts were before I started trying to do anything.

new install julia ICU.jl error

This is new:
julia> using AWS
ERROR: invalid base 10 digit 'L' in "LL"
in error at error.jl:21
in parseint_nocheck at string.jl:1520
in parseint_nocheck at string.jl:1548
in int at string.jl:1559
in include at boot.jl:245
in include_from_node1 at loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:54
in include at boot.jl:245
in include_from_node1 at loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:54
in include at boot.jl:245
in include_from_node1 at loading.jl:128
in reload_path at loading.jl:152
in _require at loading.jl:67
in require at loading.jl:51
while loading C:\Users\user.julia\v0.3\ICU\src\ICU.jl, in expression starting on line 59
while loading C:\Users\user.julia\v0.3\Calendar\src\Calendar.jl, in expression starting on line 1
while loading C:\Users\user.julia\v0.3\AWS\src\AWS.jl, in expression starting on line 3

"public-read" ACL doesn't seem to work.

I might be reading this wrong, but when I provide a public-read ACL to the S3 portions of this, I end up with the default private ACL on my buckets/objects.

[PackageEvaluator.jl] Your package AWS may have a testing issue.

This issue is being filed by a script, but if you reply, I will see it.

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their test (if available) on both the stable version of Julia (0.2) and the nightly build of the unstable version (0.3).

The results of this script are used to generate a package listing enhanced with testing results.

The status of this package, AWS, on...

  • Julia 0.2 is 'No tests, but package loads.' PackageEvaluator.jl
  • Julia 0.3 is 'No tests, but package loads.' PackageEvaluator.jl

'No tests, but package loads.' can be due to their being no tests (you should write some if you can!) but can also be due to PackageEvaluator not being able to find your tests. Consider adding a test/runtests.jl file.

'Package doesn't load.' is the worst-case scenario. Sometimes this arises because your package doesn't have BinDeps support, or needs something that can't be installed with BinDeps. If this is the case for your package, please file an issue and an exception can be made so your package will not be tested.

This automatically filed issue is a one-off message. Starting soon, issues will only be filed when the testing status of your package changes in a negative direction (gets worse). If you'd like to opt-out of these status-change messages, reply to this message.

all of the S3 function do not work

suddenly, all of the s3 function get an S3Error. Is that due to S3 outage again?
Could anyone else run the tests3.jl?

S3Response
content_length: 0
date: Tue, 14 Mar 2017 20:32:58 GMT
server: AmazonS3
eTag: 
http_code: 403
delete_marker: false
id_2: 
request_id: 
version_id: 
headers: Pair{AbstractString,AbstractString} Dict
    Transfer-Encoding => chunked
    status_code => 403
    http_major => 1
    x-amz-request-id => **********
    Content-Type => application/xml
    Date => Tue, 14 Mar 2017 20:32:58 GMT
    http_minor => 1
    Keep-Alive => 1
    Server => AmazonS3
    x-amz-id-2 => ****************=
obj: AWS.S3.S3Error("SignatureDoesNotMatch","The request signature we calculated does not match the signature you provided. Check your key and signing method.","********=","********")

Add various libraries to the AMI

I guess this is the first Julia AMI for general purpose usage. Perhaps we should make sure that this has all the various debian dependencies pre-installed so that maximal number of packages can work out of the box. It would be nice to also include HDFS in here.

Should a script for creating a Julia-AMI out of a stock Ubuntu install be included in the julia contrib?

Cc: @loladiro @pao @staticfloat

How to use S3.put_object to upload a local file

Hi again,
sorry for a probably stupid question, but... Since I now have a working installation with my local endpoint, I would like to put a pdf file into it. How can I achieve this? If I use S3.put_object(env, "mybucket", "test.pdf", "test.pdf") all I get is a document trying to be a pdf but actually just being a small test file with the filename itself. As I get it, the first call to "test.pdf" sets the resulting filename and the second is the content. But how do I get the content from the pdf file in there? I also tried a readstring("test.pdf") and serialized it using convert(Vector{Uint8}, readstring("test.pdf")) (since this is what I get from a test file on the server), but that wasn't accepted by the function.

Sorry again, but despite fiddling around, I couldn't get it to work ;-)

Conversion error with update of AWS package S3 API

I was getting this error when I installed julia 0.3.8 on Ubuntu Trusty:

ERROR: `convert` has no method matching convert(::Type{String}, ::Array{String,1})
 in convert at base.jl:13
 in do_request at /home/ubuntu/.julia/v0.3/AWS/src/S3.jl:571
 in get_object at /home/ubuntu/.julia/v0.3/AWS/src/S3.jl:392

The do_http method was returning an object where the http_headers dictionary had values of Array{String, 1} instead of Type{String} as the S3Response object expected.

I've fixed this temporarily in my codebase by checking to see if each header key has a value, and then if it does, assigning the first index of the array to the S3Response object.

For the version of AWS in the julia package repo, something might need to be changed to either have do_http return http_headers as a dictionary of Type{String} or update the S3Response type to have fields of Array{String, 1} instead of String.

don't override display

You are overloading display in order to customize output. This is the wrong way to do it — see the manual on custom pretty printing.

To customize REPL output, you should override Base.show(io::IO, x::MyType) and/or Base.show(io::IO, ::MIME"text/plain", x::MyType), as explained in the manual.

Overriding display directly will break IJulia, Juno, and other environments that have a custom display mechanism.

Should automatically pick up rotated instance credentials

If ec2_creds is used, then rotated credentials should automatically be picked up in order to support long running processes. In my experience, instance credentials tend to expire after about 6.5 hours, but new credentials are rotated in every hour or so.

[PkgEval] AWS may have a testing issue on Julia 0.3 (2014-08-16)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.3

  • On 2014-08-15 the testing status was No tests, but package loads.
  • On 2014-08-16 the testing status changed to Package doesn't load.

No tests, but package loads. means that PackageEvaluator did not find tests for your package. However, trying to load your package with using worked.

Package doesn't load. means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using failed.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("AWS")' log
INFO: Cloning cache of AWS from git://github.com/amitmurthy/AWS.jl.git
INFO: Cloning cache of Calendar from git://github.com/nolta/Calendar.jl.git
INFO: Cloning cache of Codecs from git://github.com/dcjones/Codecs.jl.git
INFO: Cloning cache of HTTPClient from git://github.com/amitmurthy/HTTPClient.jl.git
INFO: Cloning cache of ICU from git://github.com/nolta/ICU.jl.git
INFO: Cloning cache of LibCURL from git://github.com/amitmurthy/LibCURL.jl.git
INFO: Cloning cache of LibExpat from git://github.com/amitmurthy/LibExpat.jl.git
INFO: Installing AWS v0.1.8
INFO: Installing BinDeps v0.3.0
INFO: Installing Calendar v0.4.2
INFO: Installing Codecs v0.1.2
INFO: Installing HTTPClient v0.1.4
INFO: Installing ICU v0.4.1
INFO: Installing LibCURL v0.1.3
INFO: Installing LibExpat v0.0.4
INFO: Installing SHA v0.0.2
INFO: Installing URIParser v0.0.2
INFO: Building ICU
=================================[ ERROR: ICU ]=================================

None of the selected providers can install dependency icu.
Use BinDeps.debug(package_name) to see available providers

while loading /home/idunning/pkgtest/.julia/v0.3/ICU/deps/build.jl, in expression starting on line 28

================================================================================
INFO: Building LibCURL

================================[ BUILD ERRORS ]================================

WARNING: ICU had build errors.

 - packages with build errors remain installed in /home/idunning/pkgtest/.julia/v0.3
 - build a package and all its dependencies with `Pkg.build(pkg)`
 - build a single package by running its `deps/build.jl` script

================================================================================
INFO: Package database updated

>>> 'using AWS' log

ERROR: could not open file /home/idunning/pkgtest/.julia/v0.3/ICU/src/../deps/deps.jl
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:54
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:54
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:285
 in _start at ./client.jl:354
 in _start_3B_1699 at /home/idunning/julia03/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.3/ICU/src/ICU.jl, in expression starting on line 54
while loading /home/idunning/pkgtest/.julia/v0.3/Calendar/src/Calendar.jl, in expression starting on line 1
while loading /home/idunning/pkgtest/.julia/v0.3/AWS/src/AWS.jl, in expression starting on line 3
while loading /home/idunning/pkgtest/.julia/v0.3/AWS/testusing.jl, in expression starting on line 1

>>> test log
no tests to run
>>> end of log

AWS S3 and JLD

Hello All,
I am working on large machine learning project, where data are stored in S3. My plan is to asynchronously download data to workers that would learn the Neural Network or do other magic on them.

So far, I have encountered two limitations.
Firstly,

AWS.S3.get_bkt(env,bucket_name,options=AWS.S3.GetBucketOptions(max_keys=2000))

returns at most 1000 elements of the bucket, even though I requested more.

Secondly, when I download the file stored as jld, I cannot parse it. After downloading the file issuing

r = AWS.S3.get_object(env,bkt,file_name);
r.obj is of type Array{UInt8,1} but I cannot load it using load(IOBuffer(r.obj)).

Has anyone tried to overcome these issues?

Thanks for suggestions.
Tomas

Feature request: nonblocking calls to S3

It would be nice to have the various calls to S3 (e.g., get_object) optionally be nonblocking in order to facilitate asynchronous IO.

I was hoping it would be as simple as setting RequestOptions.blocking to false before calling HTTPC.get(), but that results in a conversion error in AWS.S3.do_request(): for reasons I don't understand, the header's Date field apparently contains an Array instead of a String when RequestOptions.blocking == false. I can't tell if that's a bug or a feature.

Typo in ec2_simple.jl: Passing in the right environment

Dear all,

thanks for this package!

Line 203 of ec2_simple.jl (commit de12551) should be replaced with

hosts = ec2_hostnames(instances, env=env)

(the env=env part was missing). Without this change, AWS.EC2 can't find the instance if it is not in the region us-east-1.

All the best,
Philipp.

[PkgEval] AWS may have a testing issue on Julia 0.4 (2014-08-16)

PackageEvaluator.jl is a script that runs nightly. It attempts to load all Julia packages and run their tests (if available) on both the stable version of Julia (0.3) and the nightly build of the unstable version (0.4). The results of this script are used to generate a package listing enhanced with testing results.

On Julia 0.4

  • On 2014-08-15 the testing status was No tests, but package loads.
  • On 2014-08-16 the testing status changed to Package doesn't load.

No tests, but package loads. means that PackageEvaluator did not find tests for your package. However, trying to load your package with using worked.

Package doesn't load. means that PackageEvaluator did not find tests for your package. Additionally, trying to load your package with using failed.

This issue was filed because your testing status became worse. No additional issues will be filed if your package remains in this state, and no issue will be filed if it improves. If you'd like to opt-out of these status-change messages, reply to this message saying you'd like to and @IainNZ will add an exception. If you'd like to discuss PackageEvaluator.jl please file an issue at the repository. For example, your package may be untestable on the test machine due to a dependency - an exception can be added.

Test log:

>>> 'Pkg.add("AWS")' log
INFO: Installing AWS v0.1.8
INFO: Installing BinDeps v0.3.0
INFO: Installing Calendar v0.4.2
INFO: Installing Codecs v0.1.2
INFO: Installing HTTPClient v0.1.4
INFO: Installing ICU v0.4.1
INFO: Installing LibCURL v0.1.3
INFO: Installing LibExpat v0.0.4
INFO: Installing SHA v0.0.2
INFO: Installing URIParser v0.0.2
INFO: Building ICU
=================================[ ERROR: ICU ]=================================

None of the selected providers can install dependency icu.
Use BinDeps.debug(package_name) to see available providers

while loading /home/idunning/pkgtest/.julia/v0.4/ICU/deps/build.jl, in expression starting on line 28

================================================================================
INFO: Building LibCURL

================================[ BUILD ERRORS ]================================

WARNING: ICU had build errors.

 - packages with build errors remain installed in /home/idunning/pkgtest/.julia/v0.4
 - build a package and all its dependencies with `Pkg.build(pkg)`
 - build a single package by running its `deps/build.jl` script

================================================================================
INFO: Package database updated

>>> 'using AWS' log
ERROR: could not open file /home/idunning/pkgtest/.julia/v0.4/ICU/src/../deps/deps.jl
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:54
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:54
 in include at ./boot.jl:245
 in include_from_node1 at ./loading.jl:128
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
 in include at ./boot.jl:245
 in include_from_node1 at loading.jl:128
 in process_options at ./client.jl:285
 in _start at ./client.jl:354
 in _start_3B_3500 at /home/idunning/julia04/usr/bin/../lib/julia/sys.so
while loading /home/idunning/pkgtest/.julia/v0.4/ICU/src/ICU.jl, in expression starting on line 54
while loading /home/idunning/pkgtest/.julia/v0.4/Calendar/src/Calendar.jl, in expression starting on line 1
while loading /home/idunning/pkgtest/.julia/v0.4/AWS/src/AWS.jl, in expression starting on line 3
while loading /home/idunning/pkgtest/.julia/v0.4/AWS/testusing.jl, in expression starting on line 1


>>> test log
no tests to run
>>> end of log

S3 APIs throw error on Julia v0.4

S3 bucket listing fails on Julia v0.4:

List all buckets
ERROR: LoadError: Associative collections only contain Pairs;
Either look for e.g. A=>B instead, or use the `keys` or `values`
function if you are looking for a key or value respectively.
 in in at dict.jl:13
 in get_canon_amz_headers at /home/tanmaykm/.julia/v0.4/AWS/src/S3.jl:777
 in canonicalize_and_sign at /home/tanmaykm/.julia/v0.4/AWS/src/S3.jl:683
 in do_http at /home/tanmaykm/.julia/v0.4/AWS/src/S3.jl:612
 in __do_request#664__ at no file
 [inlined code] from /home/tanmaykm/.julia/v0.4/AWS/src/S3.jl:17
 in list_all_buckets at /home/tanmaykm/.julia/v0.4/AWS/src/S3.jl:71
 in include at ./boot.jl:260
 in include_from_node1 at ./loading.jl:271
 in process_options at ./client.jl:308
 in _start at ./client.jl:411
while loading /home/tanmaykm/.julia/v0.4/AWS/test/tests3.jl, in expression starting on line 9

ec2_simple.jl

I am trying to start few instances using the ec2_simple API. I have followed the instruction in sample/README.md to the latter, but I get

julia> using AWS
INFO: using default region: us-east-1

julia> using AWS.EC2

julia> include("launch.jl")
ERROR: LoadError: UndefVarError: ec2_launch not defined
Stacktrace:
 [1] include_from_node1(::String) at ./loading.jl:576
 [2] include(::String) at /Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib:?

I realized that ec2_simple.jl is not sourced. So if I do

include("/Users/myuser/.julia/v0.6/AWS/src/ec2_simple.jl")
import AWS: AbstractAWSType
include("/Users/myuser/.julia/v0.6/AWS/src/ec2_types.jl")

and then

julia> include("launch.jl")
ERROR: LoadError: UndefVarError: RunInstancesType not defined
Stacktrace:
 [1] #ec2_launch#7(::AWS.AWSEnv, ::String, ::Int64, ::String, ::String, ::String, ::Function, ::String, ::String) at /Users/myuser/.julia/v0.6/AWS/src/ec2_simple.jl:80
 [2] (::#kw##ec2_launch)(::Array{Any,1}, ::#ec2_launch, ::String, ::String) at ./<missing>:0
 [3] include_from_node1(::String) at ./loading.jl:576
 [4] include(::String) at /Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib:?
while loading /Users/myuser/launch.jl, in expression starting on line 6

RunInstancesType is mentioned in the README.md which says that RunInstancesType is defined in ec2_types.jl, but there is no trace of it anywhere.

I bet I am doing something terribly stupid, but since there is a slim chance that something is wrong with the simple interface I am reporting this as an issue.

Invalid character: " " error

$ ./julia
               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "help()" to list help topics
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.3.0-prerelease+3048 (2014-05-14 16:03 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 6e77ede (0 days old master)
|__/                   |  x86_64-apple-darwin12.5.0

julia> using AWS
ERROR: syntax: invalid character "​"
 in include at boot.jl:244 (repeats 2 times)
 in reload_path at loading.jl:152
 in _require at loading.jl:67
 in require at loading.jl:51
while loading /Users/sabae/.julia/AWS/src/S3.jl, in expression starting on line 1
while loading /Users/sabae/.julia/AWS/src/AWS.jl, in expression starting on line 84

Incorrect format for region specific S3 urls

For the AWS.S3 module, when a region is specified in the AWS config file, the current code uses an old, no longer valid URL format to build out the URL.

The old format is:
https://s3-$(env.region).amazonaws.com" * full_path

The correct format is:
"https://$(env.region).s3.amazonaws.com" * full_path

MD5 error

julia> f = open("/tmp/julia-packaging/Julia-0.2-pre.dmg","r")
IOStream(<file /tmp/julia-packaging/Julia-0.2-pre.dmg>)

julia> S3.put_object(env, "julianightlies", "Julia-0.2-pre.dmg", f)
S3Response(0,"Fri, 28 Jun 2013 20:44:09 GMT","AmazonS3","",400,false,"nVliiGkEIZncNhyoqR4z4pPj9vnS6fC1jXav/4/J9ZCAdpIxo/35dIF79zS064fc","B8BEDC55F8828B88","",["Connection"=>"close","x-amz-id-2"=>"nVliiGkEIZncNhyoqR4z4pPj9vnS6fC1jXav/4/J9ZCAdpIxo/35dIF79zS064fc","Content-Type"=>"application/xml","Date"=>"Fri, 28 Jun 2013 20:44:09 GMT","x-amz-request-id"=>"B8BEDC55F8828B88","Transfer-Encoding"=>"chunked","Server"=>"AmazonS3"],S3Error("BadDigest","The Content-MD5 you specified did not match what we received.",nothing,"nVliiGkEIZncNhyoqR4z4pPj9vnS6fC1jXav/4/J9ZCAdpIxo/35dIF79zS064fc","B8BEDC55F8828B88"),<Error><Code>BadDigest</Code><Message>The Content-MD5 you specified did not match what we received.</Message><ExpectedDigest>gLxIjMpxrJzqKFCfngbjQA==</ExpectedDigest><CalculatedDigest>1B2M2Y8AsgTpgAmY7PhCfg==</CalculatedDigest><RequestId>B8BEDC55F8828B88</RequestId><HostId>nVliiGkEIZncNhyoqR4z4pPj9vnS6fC1jXav/4/J9ZCAdpIxo/35dIF79zS064fc</HostId></Error>)

julia> println(ans.obj)
S3Error("BadDigest","The Content-MD5 you specified did not match what we received.",nothing,"nVliiGkEIZncNhyoqR4z4pPj9vnS6fC1jXav/4/J9ZCAdpIxo/35dIF79zS064fc","B8BEDC55F8828B88")

Is this an error of my doing? Or is this something that is broken in our MD5 calculation?

Move crypto functions to Codecs module?

I've been working on building a Twitter package and needed a SHA1 function. Does it make sense to move those functions into Codec.jl, so that they are in a common location?

Error compiling hmacsha1_digest on Windows 7

Stack trace reads:

ERROR: error compiling hmacsha1_digest: could not load module libcrypto: %1 is n
ot a valid Win32 application.

in canonicalize_and_sign at C:\Users\Andrew Martin.julia\v0.3\AWS\src\S3.jl:69
7
in do_http at C:\Users\Andrew Martin.julia\v0.3\AWS\src\S3.jl:614
in do_request at C:\Users\Andrew Martin.julia\v0.3\AWS\src\S3.jl:564
in get_object at C:\Users\Andrew Martin.julia\v0.3\AWS\src\S3.jl:392

Running on 64-bit Windows 7.

no method *((ASCIIString,ASCIIString),ASCIIString)

julia> env = AWSEnv()

julia> acl = S3.S3_ACL()

julia> acl.acl = "public-read"

julia> S3.put_object_acl(env, "julialang", key, acl )
ERROR: no method *((ASCIIString,ASCIIString),ASCIIString)
 in * at operators.jl:68
 in anonymous at /Users/sabae/.julia/AWS/src/S3.jl:794
 in r_pairwise at reduce.jl:135
 in reduce at reduce.jl:183
 in get_canon_amz_headers at /Users/sabae/.julia/AWS/src/S3.jl:794
 in canonicalize_and_sign at /Users/sabae/.julia/AWS/src/S3.jl:685
 in do_http at /Users/sabae/.julia/AWS/src/S3.jl:614
 in do_request at /Users/sabae/.julia/AWS/src/S3.jl:564
 in put_object_acl at /Users/sabae/.julia/AWS/src/S3.jl:481

This on:

julia> versioninfo()
Julia Version 0.2.0-rc3+46
Commit fc174d3 (2013-11-10 16:38 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin12.5.0)
  WORD_SIZE: 64
  BLAS: libgfortblas
  LAPACK: liblapack
  LIBM: libopenlibm

Can't install package - Julia 0.4.6

I am running Julia 0.4.6 on ubuntu 14.04.5 LTS
I installed all the required packages and I am getting the following errors. Do you know what the problem can be? Thanks a lot.

WARNING: Error during initialization of module GMP:
ErrorException("The dynamically loaded GMP library (version 6.1.0 with __gmp_bits_per_limb == 64)
does not correspond to the compile time version (version 5.1.3 with __gmp_bits_per_limb == 64).
Please rebuild Julia.")

=============================[ ERROR: HttpParser ]==============================

LoadError: could not spawn unzip -x /home/ubuntu/.julia/v0.4/HttpParser/deps/downloads/v2.7.1.zip -d /home/ubuntu/.julia/v0.4/HttpParser/deps/src: n
o such file or directory (ENOENT)
while loading /home/ubuntu/.julia/v0.4/HttpParser/deps/build.jl, in expression starting on line 71

INFO: Building MbedTLS
cmake command not found. installing cmake is required for building from source.
===============================[ ERROR: MbedTLS ]===============================

LoadError: failed process: Process(./cmake_check.sh, ProcessExited(1)) [1]
while loading /home/ubuntu/.julia/v0.4/MbedTLS/deps/build.jl, in expression starting on line 74

INFO: Building LightXML
INFO: Building AWS

===================================================================[ BUILD ERRORS ]===================================================================

WARNING: HttpParser and MbedTLS had build errors.

  • packages with build errors remain installed in /home/ubuntu/.julia/v0.4
  • build the package(s) and all dependencies with Pkg.build("HttpParser", "MbedTLS")
  • build a single package by running its deps/build.jl script

S3.get_bkt(...) gives missing method error -- possible LibExpat issue

Not sure if this is a problem with AWS.jl or LibExpat.jl: pinning to version v0.0.8 of LibExpat.jl makes the error go away.

julia> opt = S3.GetBucketOptions(prefix=_prefix, marker=""); resp = S3.get_bkt(env, bkt, options=opt)
ERROR: `find` has no method matching find(::ETree, ::ASCIIString)
in ListBucketResult at /home/user/.julia/v0.3/AWS/src/s3_types.jl:206
in get_bkt at /home/user/.julia/v0.3/AWS/src/S3.jl:22

versioninfo():

Julia Version 0.3.8-pre+22
Commit 5078421* (2015-04-28 09:05 UTC)
Platform Info:
  System: Linux (x86_64-amazon-linux)
  CPU: Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libmkl_rt
  LAPACK: libmkl_rt
  LIBM: libimf
  LLVM: libLLVM-3.3

deprecation warning with Julia v0.6

WARNING: Array{T}(::Type{T}, m::Int) is deprecated, use Array{T}(m) instead.
Stacktrace:
 [1] depwarn(::String, ::Symbol) at ./deprecated.jl:70
 [2] Array(::Type{Tuple}, ::Int64) at ./deprecated.jl:57
 [3] call_ec2(::AWS.AWSEnv, ::String, ::AWS.EC2.DescribeInstancesType) at /.julia/v0.6/AWS/src/ec2_typed.jl:67
 [4] DescribeInstances(::AWS.AWSEnv, ::AWS.EC2.DescribeInstancesType) at /.julia/v0.6/AWS/src/ec2_operations.jl:1384
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.