• Stars
    star
    119
  • Rank 287,448 (Top 6 %)
  • Language
    Go
  • License
    Other
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple no frills AWS S3 Golang Library using REST with V4 Signing (without AWS Go SDK)

simples3 : Simple no frills AWS S3 Library using REST with V4 Signing

Overview GoDoc Go Report Card GoCover Zerodha Tech

SimpleS3 is a Go library for manipulating objects in S3 buckets using REST API calls or Presigned URLs signed using AWS Signature Version 4.

Install

go get github.com/rhnvrm/simples3

Example

testTxt, _ := os.Open("testdata/test.txt")
defer testTxt.Close()

// Create an instance of the package
// You can either create by manually supplying credentials
// (preferably using Environment vars)
s3 := simples3.New(Region, AWSAccessKey, AWSSecretKey)
// or you can use this on an EC2 instance to 
// obtain credentials from IAM attached to the instance.
s3, _ := simples3.NewUsingIAM(Region)

// You can also set a custom endpoint to a compatible s3 instance. 
s3.SetEndpoint(CustomEndpoint)

// Note: Consider adding a testTxt.Seek(0, 0)
// in case you have read 
// the body, as the pointer is shared by the library.

// File Upload is as simple as providing the following
// details.
resp, err := s3.FileUpload(simples3.UploadInput{
    Bucket:      AWSBucket,
    ObjectKey:   "test.txt",
    ContentType: "text/plain",
    FileName:    "test.txt",
    Body:        testTxt,
})

// Similarly, Files can be deleted.
err := s3.FileDelete(simples3.DeleteInput{
    Bucket:    os.Getenv("AWS_S3_BUCKET"),
    ObjectKey: "test.txt",
})

// You can also download the file.
file, _ := s3.FileDownload(simples3.DownloadInput{
    Bucket:    AWSBucket,
    ObjectKey: "test.txt",
})

data, _ := ioutil.ReadAll(file)
file.Close()

// You can also use this library to generate
// Presigned URLs that can for eg. be used to
// GET/PUT files on S3 through the browser.
var time, _ = time.Parse(time.RFC1123, "Fri, 24 May 2013 00:00:00 GMT")

url := s.GeneratePresignedURL(PresignedInput{
    Bucket:        AWSBucket,
    ObjectKey:     "test.txt",
    Method:        "GET",
    Timestamp:     time,
    ExpirySeconds: 86400,
})

Contributing

You are more than welcome to contribute to this project. Fork and make a Pull Request, or create an Issue if you see any problem or want to propose a feature.

Author

Rohan Verma [email protected]

License

BSD-2-Clause-FreeBSD

More Repositories

1

galaxy-image-classifier-tensorflow

Classify whether an image is of a Spiral or an Elliptical Galaxy using Transfer Learning (Tensorflow)
Python
184
star
2

labeled-tweet-generator

Search for tweets and download the data labeled with its polarity in CSV format
HTML
111
star
3

lyric-api

🎼 API and NPM Module for fetching lyrics from lyrics.wikia.com
JavaScript
97
star
4

linkpage

LinkPage is a FOSS self-hosted alternative to link listing websites such as LinkTree and Campsite.bio
Go
59
star
5

SubScribe

πŸ“Ή Convert your video files to images transcribed with their subtitles
Python
29
star
6

lyric-api-go

🎼 API to search for lyrics from various providers.
Go
18
star
7

machine-learning-nanodegree

Project Portfolio for Machine Learning Nanodegree by Udacity
HTML
17
star
8

ConstAssemblyBot

A twitter bot that tweets a sentence from the Indian Constituent Assembly Debates every 10 minutes.
Python
13
star
9

bodhi

A simple, minimal, personal website theme for Hugo.
HTML
11
star
10

snu-data-limit

⬇️ Google Chrome Extension that calculates the data you have downloaded since last Wednesday at Shiv Nadar University
JavaScript
10
star
11

universe-coaster-racer-challenge

OpenAI Universe - Coaster Racer Challenge Submission
Python
9
star
12

chefrank

πŸ“ˆ View your Institute's Monthly Ranking's on codechef.com using rhnvrm/codechef-api-bouncer http://rhnvrm.github.io/chefrank
CSS
8
star
13

NuDrop

Python
7
star
14

brick_game

πŸ‘Ύ A classic game written in Turbo C++ | Highschool Project
C++
6
star
15

czero

Counter Strike: Condition Zero - Dedicated Server using Docker
Pawn
5
star
16

simplelock

Fast and simple wrapper over i3lock with multiple modes. Supports xkcd and unsplash
Shell
5
star
17

frozen-lobster

Daily top stories from lobste.rs frozen in time.
HTML
5
star
18

textsimilarity

go package that provides similarity between two string documents using cosine similarity and tf-idf along with various other useful things.
Go
5
star
19

breeze-website

✨ Official Website for Breeze 2016 ✨
CSS
4
star
20

Baato

πŸ’Ύ Multi threaded HTTP server along with a Flask server which lists all other Baato HTTP servers running on your LAN
Python
4
star
21

breeze-photo-booth

Breezify your Profile Photo and share on FB
PHP
4
star
22

30s_challenge

:trollface: A small script in js to solve the 30s_challege http://christianp.github.io/30secondchallenge/ posted on HackerNews
JavaScript
4
star
23

back2work

πŸ”” Chrome extension to display small notification on selected websites to remind you to get back to work.
JavaScript
4
star
24

resume

Resume Latex Class for Shiv Nadar University
TeX
3
star
25

dotfiles

πŸ”§ my .files, including some of my scripts
Shell
3
star
26

summio

AI summary portal for PDFs
Go
3
star
27

codechef-api-bouncer

:trollface: Bypass CORS for Codechef.com's Search API
Python
3
star
28

algo

Coursework for Algorithms
C
2
star
29

workshop-tools

Minimal Leaderboard for Workshops
Python
2
star
30

htn

ToroGo App - Let Data Science decide the perfect neighborhood for you in Toronto
Jupyter Notebook
2
star
31

java_learn

Coursework for SNU CSD 207 - Object Oriented Programming in Java
Java
2
star
32

merapaisa

An app for college students to keep track of their money made using MeteorJS for PECfest Hackathon Prelims 2014
JavaScript
2
star
33

tg-taskwarrior-bot

Self-hostable Telegram bot to interface with Taskwarrior through the inthe.am api
Go
2
star
34

youtube-local

youtube over lan
JavaScript
2
star
35

mini-projects

Miniprojects and Scripts
HTML
2
star
36

forer-effect-demo

A demonstration of the Forer effect also called the Barnum effect.
HTML
1
star
37

os-course

Coursework for Operating Systems course
C
1
star
38

bbc-school-report-apeejay-pitampura

An old website I found from my backups. Originally was a wordpress blog.
HTML
1
star
39

azure-design-architects

CSS
1
star
40

varsity-twitter-bot

I am a bot that tweets key takeaways from Zerodha Varsity modules.
Python
1
star
41

rohanverma.net

Personal Website (hugo v3)
1
star
42

networks

Computer Networks 2016
CSS
1
star
43

iot-hackerearth

IOT solution made for IOT Hackathon hosted by Hackerearth Jan '16. TODO
Python
1
star
44

allura-website

This is a fork of https://forge-allura.apache.org/p/allura/website/ci/asf-site/tree/
ApacheConf
1
star
45

nats-publish-py

Minimal go-nats protocol publish-only client written in python. 🐍
Python
1
star
46

bhav-browser

End of Day BSE Equity browser
Python
1
star
47

yt2embed

Redirect Youtube Videos to the Embed Page
JavaScript
1
star
48

swdel-lost-and-found-twitter-bot

🐦 Twitter bot made at Startup Weekend Delhi Feb 2016 that matches people who have lost and found things using NLTK + Tweepy
Python
1
star