curl "https://mybucket.storage.nami.cloud/example.jpg" \
-H "Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20231028/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-date, Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024" \
--output example.jpg
import boto3
s3_client = boto3.client('s3',
endpoint_url='https://storage.nami.cloud',
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY'
)
s3_client.download_file(
Bucket='mybucket',
Key='example.jpg',
Filename='downloaded_example.jpg'
)
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
import { createWriteStream } from "fs";
const client = new S3Client({
endpoint: "https://storage.nami.cloud",
credentials: {
accessKeyId: "YOUR_ACCESS_KEY",
secretAccessKey: "YOUR_SECRET_KEY",
},
});
async function downloadFile() {
const command = new GetObjectCommand({
Bucket: "mybucket",
Key: "example.jpg",
});
try {
const response = await client.send(command);
const writeStream = createWriteStream('downloaded_example.jpg');
response.Body.pipe(writeStream);
} catch (err) {
console.error("오류:", err);
}
}
downloadFile();
package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"os"
)
func main() {
sess := session.Must(session.NewSession(&aws.Config{
Endpoint: aws.String("https://storage.nami.cloud"),
Region: aws.String("us-east-1"),
Credentials: credentials.NewStaticCredentials("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", ""),
}))
s3Client := s3.New(sess)
file, err := os.Create("downloaded_example.jpg")
if err != nil {
panic(err)
}
defer file.Close()
result, err := s3Client.GetObject(&s3.GetObjectInput{
Bucket: aws.String("mybucket"),
Key: aws.String("example.jpg"),
})
if err != nil {
panic(err)
}
defer result.Body.Close()
_, err = file.ReadFrom(result.Body)
if err != nil {
panic(err)
}
}
use aws_sdk_s3::{Client, Config};
use aws_config::credentials::StaticCredentialsProvider;
use aws_types::region::Region;
use tokio::fs::File;
use tokio::io::AsyncWriteExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let credentials = StaticCredentialsProvider::new(
"YOUR_ACCESS_KEY".to_string(),
"YOUR_SECRET_KEY".to_string(),
None,
);
let config = Config::builder()
.endpoint_url("https://storage.nami.cloud")
.region(Region::new("us-east-1"))
.credentials_provider(credentials)
.build();
let client = Client::from_conf(config);
let response = client
.get_object()
.bucket("mybucket")
.key("example.jpg")
.send()
.await?;
let mut file = File::create("downloaded_example.jpg").await?;
let bytes = response.body.collect().await?.into_bytes();
file.write_all(&bytes).await?;
println!("다운로드 성공!");
Ok(())
}
{
"Name": "<string>",
"Prefix": "<string>",
"MaxKeys": 123,
"IsTruncated": true,
"Contents": [
{
"Key": "<string>",
"LastModified": "2023-11-07T05:31:56Z",
"ETag": "<string>",
"Size": 123,
"StorageClass": "<string>"
}
]
}객체 작업
객체 가져오기
최첨단 글로벌 합의 프로토콜 및 분산 저장소로 클라우드 서비스를 혁신하다
GET
/
curl "https://mybucket.storage.nami.cloud/example.jpg" \
-H "Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20231028/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-date, Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024" \
--output example.jpg
import boto3
s3_client = boto3.client('s3',
endpoint_url='https://storage.nami.cloud',
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY'
)
s3_client.download_file(
Bucket='mybucket',
Key='example.jpg',
Filename='downloaded_example.jpg'
)
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
import { createWriteStream } from "fs";
const client = new S3Client({
endpoint: "https://storage.nami.cloud",
credentials: {
accessKeyId: "YOUR_ACCESS_KEY",
secretAccessKey: "YOUR_SECRET_KEY",
},
});
async function downloadFile() {
const command = new GetObjectCommand({
Bucket: "mybucket",
Key: "example.jpg",
});
try {
const response = await client.send(command);
const writeStream = createWriteStream('downloaded_example.jpg');
response.Body.pipe(writeStream);
} catch (err) {
console.error("오류:", err);
}
}
downloadFile();
package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"os"
)
func main() {
sess := session.Must(session.NewSession(&aws.Config{
Endpoint: aws.String("https://storage.nami.cloud"),
Region: aws.String("us-east-1"),
Credentials: credentials.NewStaticCredentials("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", ""),
}))
s3Client := s3.New(sess)
file, err := os.Create("downloaded_example.jpg")
if err != nil {
panic(err)
}
defer file.Close()
result, err := s3Client.GetObject(&s3.GetObjectInput{
Bucket: aws.String("mybucket"),
Key: aws.String("example.jpg"),
})
if err != nil {
panic(err)
}
defer result.Body.Close()
_, err = file.ReadFrom(result.Body)
if err != nil {
panic(err)
}
}
use aws_sdk_s3::{Client, Config};
use aws_config::credentials::StaticCredentialsProvider;
use aws_types::region::Region;
use tokio::fs::File;
use tokio::io::AsyncWriteExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let credentials = StaticCredentialsProvider::new(
"YOUR_ACCESS_KEY".to_string(),
"YOUR_SECRET_KEY".to_string(),
None,
);
let config = Config::builder()
.endpoint_url("https://storage.nami.cloud")
.region(Region::new("us-east-1"))
.credentials_provider(credentials)
.build();
let client = Client::from_conf(config);
let response = client
.get_object()
.bucket("mybucket")
.key("example.jpg")
.send()
.await?;
let mut file = File::create("downloaded_example.jpg").await?;
let bytes = response.body.collect().await?.into_bytes();
file.write_all(&bytes).await?;
println!("다운로드 성공!");
Ok(())
}
{
"Name": "<string>",
"Prefix": "<string>",
"MaxKeys": 123,
"IsTruncated": true,
"Contents": [
{
"Key": "<string>",
"LastModified": "2023-11-07T05:31:56Z",
"ETag": "<string>",
"Size": 123,
"StorageClass": "<string>"
}
]
}가져오려는 객체에 대한 읽기 권한이 있는지 확인하십시오.
객체 가져오기
Nami Cloud Storage에서 객체를 가져옵니다. 객체 데이터는 응답 본문에서 스트리밍됩니다.기본 URL
https://${bucketname}.storage.nami.cloud
매개변수
필수
가져올 객체의 키
헤더
객체의 지정된 범위 바이트를 다운로드합니다.
지정된 엔터티 태그(ETag)와 동일한 경우에만 객체를 반환합니다.
지정된 시간 이후에 수정된 경우에만 객체를 반환합니다.
요청 예제
curl "https://mybucket.storage.nami.cloud/example.jpg" \
-H "Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20231028/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-date, Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024" \
--output example.jpg
import boto3
s3_client = boto3.client('s3',
endpoint_url='https://storage.nami.cloud',
aws_access_key_id='YOUR_ACCESS_KEY',
aws_secret_access_key='YOUR_SECRET_KEY'
)
s3_client.download_file(
Bucket='mybucket',
Key='example.jpg',
Filename='downloaded_example.jpg'
)
import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3";
import { createWriteStream } from "fs";
const client = new S3Client({
endpoint: "https://storage.nami.cloud",
credentials: {
accessKeyId: "YOUR_ACCESS_KEY",
secretAccessKey: "YOUR_SECRET_KEY",
},
});
async function downloadFile() {
const command = new GetObjectCommand({
Bucket: "mybucket",
Key: "example.jpg",
});
try {
const response = await client.send(command);
const writeStream = createWriteStream('downloaded_example.jpg');
response.Body.pipe(writeStream);
} catch (err) {
console.error("오류:", err);
}
}
downloadFile();
package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"os"
)
func main() {
sess := session.Must(session.NewSession(&aws.Config{
Endpoint: aws.String("https://storage.nami.cloud"),
Region: aws.String("us-east-1"),
Credentials: credentials.NewStaticCredentials("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", ""),
}))
s3Client := s3.New(sess)
file, err := os.Create("downloaded_example.jpg")
if err != nil {
panic(err)
}
defer file.Close()
result, err := s3Client.GetObject(&s3.GetObjectInput{
Bucket: aws.String("mybucket"),
Key: aws.String("example.jpg"),
})
if err != nil {
panic(err)
}
defer result.Body.Close()
_, err = file.ReadFrom(result.Body)
if err != nil {
panic(err)
}
}
use aws_sdk_s3::{Client, Config};
use aws_config::credentials::StaticCredentialsProvider;
use aws_types::region::Region;
use tokio::fs::File;
use tokio::io::AsyncWriteExt;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let credentials = StaticCredentialsProvider::new(
"YOUR_ACCESS_KEY".to_string(),
"YOUR_SECRET_KEY".to_string(),
None,
);
let config = Config::builder()
.endpoint_url("https://storage.nami.cloud")
.region(Region::new("us-east-1"))
.credentials_provider(credentials)
.build();
let client = Client::from_conf(config);
let response = client
.get_object()
.bucket("mybucket")
.key("example.jpg")
.send()
.await?;
let mut file = File::create("downloaded_example.jpg").await?;
let bytes = response.body.collect().await?.into_bytes();
file.write_all(&bytes).await?;
println!("다운로드 성공!");
Ok(())
}
응답 예제
HTTP/1.1 200 OK
x-amz-id-2: ef8yU9AS1ed4OpIszj7UDNEHGran
x-amz-request-id: 318BC8BC143432E5
Date: Wed, 28 Oct 2023 22:32:00 GMT
Last-Modified: Wed, 28 Oct 2023 19:27:20 GMT
ETag: "b9875f283e5571ae9ac762fba126cf8d"
Content-Length: 434234
Content-Type: image/jpeg
Server: Nami Cloud
[객체 데이터]
인증
AWS Signature Version 4
쿼리 매개변수
Limits the response to keys that begin with the specified prefix
Sets the maximum number of keys returned in the response
⌘I