Skip to content
created by Aha00aAha00a at 2019-08-21
last modified by Aha00aAha00a at 2023-06-02
revision: 6

Aws S3

Scalable Storage in the cloud

[
    {
        "AllowedHeaders": [
            "*"
        ],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "http://localhost:2314",
            "https://example.com"
        ],
        "ExposeHeaders": []
    }
]

--2023-06-02

2. Signed Url

2.1. Make Signed Url With Content Disposition

const signedUrl = s3.getSignedUrl('getObject', {
    Bucket: config.aws.s3.bucket,
    Key: `Some/Where/Over/The/Rainbow`,
    Expires: 60 * 60, // seconds
    ResponseContentDisposition: `attachment; filename="${encodeURIComponent('filename.ext')}"`
});

--2018-10-08

2.2. Direct upload using Signed Url

AWS Documentation » Amazon Simple Storage Service (S3) » Developer Guide » Working with Amazon S3 Objects » Operations on Objects » Uploading Objects » Uploading Objects Using Pre-Signed URLs

  • Server - issue Signed Url
    router.get('/s3/makeSignedUrl', async (req, res) => {
        try {
            const s3 = new AWS.S3();
            const url = s3.getSignedUrl('putObject', {
                Bucket: "<bucketName>",
                Key: 'signedUrlTest/' + moment().format('YYYYMMDD.HHmmss') + '.txt',
                Expires: 60, // seconds
            });
            res.json({url});
        }
        catch(err) {
            res.json({err});
        }
    });
  • Client - Http PUT Request using Issued Signed Url
    router.get('/s3/uploadUsingSignedUrl', async (req, res) => {
        try {
            const result = await rp({
                method: "PUT",
                url: '<SignedUrl>',
                body: 'test ' + moment().format()
            });
            res.json({result});
        }
        catch(err) {
            res.json({err});
        }
    });

--2018-06-11

4.1. cp

https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html

cp <LocalPath> <S3Uri> 
cp <S3Uri> <LocalPath> 
cp <S3Uri> <S3Uri>
aws s3 cp src dst
aws s3 cp path/to/local/file.txt s3://bucket/key/file.txt
aws s3 cp s3://bucket/key/file.txt path/to/local/file.txt

--2022-01-15

4.2. sync

https://docs.aws.amazon.com/cli/latest/reference/s3/sync.html

local -> s3, s3 -> local, s3 -> s3 간 파일을 동기화한다.

aws s3 sync ./out "s3://bucket/path"

--2021-07-31

5. See Also

5.2. Similar Pages

Similar pages by cosine similarity. Words after page name are term frequency.

  • Same Wiki
    • 34.93% AWS aws(14:26), s3(25:3), amazon(4:5), service(1:5), cli(4:1), html(2:2), docs(2:1), latest(2:1), storage(2:1), cloud(1:2)
  • Sister Wikis
    • 34.24% AhaWiki:Dev Attachment s3(25:30), attachment(1:38), url(18:12), aws(14:2), name(1:12), key(4:8), file(4:7), content(3:8), object(2:9), bucket(7:1)

5.3. Adjacent Pages

Control
≤ 32
all
1.0x
1.0x
80
-120
ON
Metrics
Nodes(visible/total)0/0
Links(visible/total)0/0
Avg degree0.00
Depth coverage0
Queue(fetch/graph)0 / 0
Zoom(scale)1.00x
Ctrl/⌘ + Scroll: Zoom
Root 1-hop 2-hop+