I need to upload a file to my S3 Bucket, inside a specific directory. I've used the aws-sdk-go package and was able to upload the file using PutObject
function inside my bucket. The file will be located in bucket/root
directory.
What I need to do is to upload it inside bucket/root/subDirectory
and I'm not able to figure that one out.
Current Upload Function
_, s3Err := s3.New(s).PutObject(&s3.PutObjectInput{
Bucket: aws.String(envs.InitAWSEnvs().AWSS3Name),
Key: aws.String(fileDir),
ACL: aws.String("private"),
Body: bytes.NewReader(buffer),
ContentLength: aws.Int64(size),
ContentType: aws.String(http.DetectContentType(buffer)),
ContentDisposition: aws.String("attachment"),
ServerSideEncryption: aws.String("AES256"),
})