Support AWS S3 Server-Side Encryption (#597)

* Support AWS S3 Server-Side Encryption

* Improve documentation for aws-s3-server-side-encryption
This commit is contained in:
Emilien Kenler
2018-02-12 11:26:23 +09:00
committed by Kota Kanbe
parent 7971bdf7f7
commit 562ff7807d
3 changed files with 21 additions and 10 deletions

View File

@@ -147,11 +147,17 @@ func putObject(svc *s3.S3, k string, b []byte) error {
k = k + ".gz"
}
if _, err := svc.PutObject(&s3.PutObjectInput{
putObjectInput := &s3.PutObjectInput{
Bucket: aws.String(c.Conf.S3Bucket),
Key: aws.String(path.Join(c.Conf.S3ResultsDir, k)),
Body: bytes.NewReader(b),
}); err != nil {
}
if c.Conf.S3ServerSideEncryption != "" {
putObjectInput.ServerSideEncryption = aws.String(c.Conf.S3ServerSideEncryption)
}
if _, err := svc.PutObject(putObjectInput); err != nil {
return fmt.Errorf("Failed to upload data to %s/%s, %s",
c.Conf.S3Bucket, k, err)
}