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("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!("Download successful!");
Ok(())
}
"<string>"Object Operations
Get Object
Retrieve an object from a bucket
GET
/
{objectKey}
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("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!("Download successful!");
Ok(())
}
"<string>"Make sure you have READ permission on the object you want to retrieve.
Get Object
Retrieves objects from Nami Cloud Storage. The object data is streamed in the response body.Base URL
https://${bucketname}.storage.nami.cloud
Parameters
required
The key of the object to retrieve
Headers
Downloads the specified range bytes of an object
Return the object only if its entity tag (ETag) is the same as specified
Return the object only if it has been modified since the specified time
Request Examples
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("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!("Download successful!");
Ok(())
}
Response Example
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
[Object Data]
⌘I