Golang's http.FileSystem Implementation for AWS S3
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
596 B

package s3fs
import (
"flag"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
var (
region string
profile string
s3svc *s3.S3
)
func init() {
flag.StringVar(&region, "aws-region", "us-east-1", "Region to be used for AWS")
flag.StringVar(&profile, "aws-profile", "default", "Profile to be used for AWS")
}
func initSVC() {
if s3svc == nil {
sess := session.Must(session.NewSessionWithOptions(session.Options{
Profile: profile,
}))
s3svc = s3.New(sess, &aws.Config{
Region: aws.String(region),
})
}
}