GithubHelp home page GithubHelp logo

kareypyer / aws-s3-webdav Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lostintime/aws-s3-webdav

0.0 0.0 0.0 94 KB

Basic AWS S3 WebDAV interface implemented in Rust

License: Apache License 2.0

Shell 1.21% Rust 97.10% Dockerfile 1.69%

aws-s3-webdav's Introduction

AWS S3 WebDAV

Basic AWS S3 WebDAV interface implemented in Rust.

Supported methods

GET

Returns object contents:

curl -X GET http://localhost:8080/hello.txt

HEAD

Check object exists without fetching the body:

curl -X HEAD http://localhost:8080/hello.txt

PUT

Create or Update object:

curl -X PUT http://localhost:8080/hello.txt \
  -d 'Hello there!'

or from file:

curl -X PUT http://localhost:8080/hello.txt \
  --upload-file ./hello.txt

DELETE

Delete object:

curl -X DELETE http://localhost:8080/hello.txt 

COPY

Copy object within same bucket:

curl -X COPY http://localhost:8080/hello.txt \
  -H 'Destination: /hello2.txt'

MOVE

Move object within same bucket:

curl -X MOVE http://localhost:8080/hello.txt \
  -H 'Destination: /hello2.txt'

Configuration

Running application requires few configuration options.

AWS Region (required)

AWS service region ID can be provided using --aws-region argument or AWS_REGION environment variable.

Check Complete regions list at https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region

Bucket Name (required)

AWS S3 bucket name can be provided using --aws-bucket argument or AWS_BUCKET environment variable.

Key Prefix (optional)

A prefix to be used with key, will be automatically added before requested service path, Can be provided usign --aws-key-prefix argument or AWS_KEY_PREFIX environment variable.

For example with --aws-key-prefix=folder1/, path http://<aws-webdav-host:port>/path/to/my/file.txt will be translated to folder1/path/to/my/file.txt s3 object key.

AWS Credentials (optional)

If S3 bucket requires authorization, credentials may be provided via:

Environment variables

  • AWS_ACCESS_KEY_ID for access key
  • AWS_SECRET_ACCESS_KEY for secret

Credentials File

AWS Credentials file may be used at default location (~/.aws/credentials) or custom location configured via AWS_SHARED_CREDENTIALS_FILE environment variable.

Profile may be optionally configured using AWS_PROFILE environment variable. default profile is used by default.

IAM instance profile

Will only work if running on an EC2 instance with an instance profile/role.

(May not work with docker image, plase let me know if it does).

Running with Docker

There is an automated docker build configured for this repo: lostintime/aws-s3-webdav.

Run service container

docker run --read-only --rm \
    -p 127.0.0.1:8080:8080 \
    -v ~/.aws/credentials:/.aws/credentials \
    -e "AWS_SHARED_CREDENTIALS_FILE=/.aws/credentials" \
    -e "AWS_PROFILE=default" \
    -e "AWS_REGION=eu-central-1" \
    -e "AWS_BUCKET=my-bucket" \
    -e "AWS_KEY_PREFIX=tmp/" \
    lostintime/aws-s3-webdav:0.1.0

Limitations

HTTPS

Application now uses http protocol for communication with AWS endpoint, ssl sessions seems to leak some memory when using https, and I didn't figure out how to fix it yet.

Multipart Uploads

To upload files application uses AWS Mulipart Upload, which in case of failures in the middle of the upload will leave parts stored in S3, and you will be charged for patrs uploaded, so it's recommended to configure Bucket Lifecycle Policy.

License

Licensed under the Apache License, Version 2.0.

aws-s3-webdav's People

Contributors

lostintime avatar

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.