func copyToS3(config *Config, src, dst *FileURI) error {
	svc, err := SessionForBucket(config, dst.Bucket)
	if err != nil {
		return err
	}
	uploader := s3manager.NewUploaderWithClient(svc, func(u *s3manager.Uploader) {
		u.PartSize = config.PartSize * 1024 * 1024
		u.Concurrency = config.Concurrency
	})
	fd, err := os.Open(src.Path)
	if err != nil {
		return err
	}
	defer fd.Close()
	params := &s3manager.UploadInput{
		Bucket: aws.String(dst.Bucket),  
		Key:    cleanBucketDestPath(src.Path, dst.Path),
		Body:   fd,
	}
	if config.StorageClass != "" {
		params.StorageClass = aws.String(config.StorageClass)
	}
	_, err = uploader.Upload(params)
	if err != nil {
		return err
	}
	return nil
}
Copy from local file to S3
package main
import (
	"fmt"
	"os"
	"path"
	"path/filepath"
	"strings"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/service/s3"
	"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
func copyFile(config *Config, src, dst *FileURI, ensure_directory bool) error {
	if config.Verbose {
		fmt.Printf("Copy %s -> %s\n", src.String(), dst.String())
	}
	if config.DryRun {
		return nil
	}
	switch src.Scheme + "->" + dst.Scheme {
	case "file->file":
		return fmt.Errorf("cp should not be doing local files")
	case "s3->s3":
		return copyOnS3(config, src, dst)
	case "s3->file":
		return copyToLocal(config, src, dst, ensure_directory)
	case "file->s3":
		return copyToS3(config, src, dst)
	}
	return nil
}
func copyToLocal(config *Config, src, dst *FileURI, ensure_directory bool) error {
	svc, err := SessionForBucket(config, src.Bucket)
	if err != nil {
		return err
	}
	downloader := s3manager.NewDownloaderWithClient(svc)
	params := &s3.GetObjectInput{
		Bucket: aws.String(src.Bucket),
		Key:    src.Key(),
	}
	dst_path := dst.Path
	sinfo, err := os.Stat(dst_path)
	if err == nil && sinfo.IsDir() {
		dst_path = path.Join(dst_path, filepath.Base(src.Path))
	}
	if ensure_directory {
		dir := filepath.Dir(dst.Path)
		if _, err := os.Stat(dir); err != nil {
			if config.Verbose {
				fmt.Printf("Making directory dir=%s\n", dir)
			}
			if err := os.MkdirAll(dir, 0755); err != nil {
				fmt.Println(err)
				return fmt.Errorf("Error making directory dir=%s error=%v", dir, err)
			}
		}
	}
	fd, err := os.Create(dst_path)
	if err != nil {
		fmt.Println(err)
		return err
	}
	defer fd.Close()
	_, err = downloader.Download(fd, params)
	if err != nil {
		return err
	}
	return nil
}