0
votes

I have the next code to get URL from Amazon, but I need that URL looks something like

https://vis3dev.s3.amazonaws.com/359952_1550525274.mp4

and not

https://vis3dev.s3.amazonaws.com/266295041.mp4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIE4CD00A5BW7WNTQ%2F20190220%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190220T193732Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=ba800af2fb7b314df2f47a589165558ae50264164c686314b6d73eab2975d8f1

func GetFileLink(svc *session.Session) error {
    req, _ := s3.New(svc).GetObjectRequest(&s3.GetObjectInput{
        Bucket: aws.String(AwsBucket),
        Key:    aws.String(NameFile + ".mp4"),
    })

    url, err := req.Presign(15 * time.Minute)

    if err != nil {
        fmt.Print(err)
    }

    fmt.Println(url)

    return err
}
1
The url utils contain all you are looking for: Identification of parameters and base url. Alternative you can use a string split on "?". - Norbert van Nobelen
I tried use https://vis3dev.s3.amazonaws.com/266295041.mp4 but doesn't work always I have the file doesn't have correct format - Christian Herrejon

1 Answers

0
votes

acl := "public-read"

I fixed it changing the upload file adding ACL: aws.String(acl),