##get the aws-go sdk
cd $GOPATH/src
1 |
|
##get the asw access key and secret
get the access key and secret
reference:
http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html
get the data center region information
aws-sdk go requires region information of the data center
http://docs.aws.amazon.com/general/latest/gr/rande.html
1 |
|
sample code
1 |
|
so run the main.go file to upload the local ‘myfile.txt’ file1
2
go run main.go -b mybucket -k myKey -d 10m < myfile.txt
##how to change ‘ACL’ (access control)
S3 API support different ACL policy of an object, here is the example about how to change the file to ‘public’ read1
inputObj.SetACL(s3.BucketCannedACLPublicRead)