Created
January 18, 2018 20:39
-
-
Save artbikes/e8066c700842f4413df690ff3fd16da5 to your computer and use it in GitHub Desktop.
List all keys in S3 bucket
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/s3" | |
) | |
func main() { | |
svc := s3.New(session.New(), &aws.Config{Region: aws.String("us-east-1")}) | |
params := &s3.ListObjectsInput{ | |
Bucket: aws.String("bucket"), | |
} | |
resp, _ := svc.ListObjects(params) | |
for _, key := range resp.Contents { | |
fmt.Println(*key.Key) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment