Skip to content

Golang sample to POST directly to an S3 bucket!

Notifications You must be signed in to change notification settings

kaihendry/s3post

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video explaining the project: https://www.youtube.com/watch?v=75XYVGakPWI

Authenticated AJAX POST to AWS S3 example 🙌

Requires the following environment variables to be set:

  • BUCKET e.g. s.natalian.org, same domain as my CloudFront domain, https://s.natalian.org
  • PASSWORD e.g. "abracadabra" used to authenticate the client via a cookie
  • REGION e.g. ap-southeast-1, where the bucket is located
  • UPLOAD_ID the AWS_ACCESS_KEY_ID for uploading to the bucket only
  • UPLOAD_SECRET the secret AWS_SECRET_ACCESS_KEY counterpart to the restricted AWS_ACCESS_KEY_ID
  • NOTIFY_TOPIC SNS topic that publishes the key of the upload

S3 policy for restricting bucket upload

{ "Version": "2012-10-17",
	"Statement": [
	{
		"Sid": "Stmt1460356082000",
		"Effect": "Allow",
		"Action": [
			"s3:Put*"
		],
		"Resource": [ "arn:aws:s3:::s.natalian.org", "arn:aws:s3:::s.natalian.org/*" ]
	}
	]
}

TODO is to implement a native Golang SDK function without UPLOAD_ID/UPLOAD_SECRET createPresignedPost

https://github.com/TTLabs/EvaporateJS is far too complex. Alex Russell says they are working on it!

About

Golang sample to POST directly to an S3 bucket!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published