tencent cloud

​Intranet Upload​
마지막 업데이트 시간:2025-08-05 09:38:23
​Intranet Upload​
마지막 업데이트 시간: 2025-08-05 09:38:23
This document provides guidance for intranet network uploads in the Professional Edition application.

Applicable Scenarios​

Developers can upload files to Professional Edition storage in the same region via Tencent Cloud's intranet network.
Tencent Cloud VOD Professional Edition supports accessing stored files through Tencent Cloud's intranet network. Customers can use Tencent Cloud resources to access Professional Edition storage in the same region via the intranet network. When accessing via the intranet network, uploading and downloading files do not incur traffic fees.

​Upload Methods​

Intranet network uploads support the following methods:
Upload Method
Upload Domain
Credentials
Supported Operations
Bucket Internal Preset Domain
[BucketId].vodsrc-internal.[Region].eovod.com
AccessKeys
Upload to specified bucket

​Bucket Intranet Preset Domain​

The Professional Edition application preset an intranet domain for each bucket. Customers can use this domain to upload files to buckets in the same region via the intranet network on Tencent Cloud servers.

​Uploading Files via AWS S3 SDK Using AccessKeys

Below are examples of uploading files to a Professional Edition application bucket in various programming languages.
​Assumptions:
Professional Edition App ID: 1234567890
Bucket Region: ap-guangzhou
Bucket ID: bucketid1
Internal Access Domain: bucketid1.vodsrc-internal.ap-guangzhou.eovod.com

​Prerequisites

1. ​Create the Professional Edition application and bucket in the VOD Console. For specific steps, refer to Quick Start and Create Bucket.
2. Obtain Tencent Cloud account AccessKey pair:
Obtain the key pair AccessKeyId and SecretAccessKey from the key management of the professional version application. For detailed steps, refer to the Key Management documentation
3. ​Verify Internal Network Access​.
Internal domains must be accessed from Tencent Cloud servers in the same region as the bucket. Test with commands like nslookup. If resolved IPs resemble 10.*.*.*, 100.*.*.*, or 169.254.*.*, intranet access is available.

​Upload Examples​

Code implementations for initializing the S3 client and uploading files in various languages:
GO
Java
C++
Python
// Package main
// This example is implemented based on AWS SDK for Go v2 service/s3 v1.72.3.
// For AWS SDK for Go v2 service/s3 v1.73.0 and later versions, S3's default integrity protection must be disabled.
// For more details, refer to: https://github.com/aws/aws-sdk-go-v2/discussions/2960
package main

import (
"context"
"errors"
"fmt"
"log"
"net/url"
"os"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/feature/s3/manager"
"github.com/aws/aws-sdk-go-v2/service/s3"
smep "github.com/aws/smithy-go/endpoints"
"github.com/aws/smithy-go/logging"
)

// Custom endpoint resolver
type customEndpointResolverV2 struct{}

func (r *customEndpointResolverV2) ResolveEndpoint(ctx context.Context,
params s3.EndpointParameters) (smep.Endpoint, error) {
if params.Bucket == nil || params.Region == nil {
return smep.Endpoint{}, errors.New("invalid endpoint param")
}
return smep.Endpoint{
URI: url.URL{
Scheme: "https",
Host: fmt.Sprintf("%s.vodsrc-internal.ap-guangzhou.eovod.com", *params.Bucket),
},
}, nil
}

func main() {
// Initialize S3 client
s3cli := s3.New(s3.Options{
Credentials: credentials.NewStaticCredentialsProvider(
"AccessKeyId", // Replace with your AccessKeyId
"SecretAccessKey", // Replace with your SecretAccessKey
""), // SessionToken not needed for AccessKeys
EndpointResolverV2: new(customEndpointResolverV2), // Custom endpoint
UsePathStyle: false, // Disable path style
Logger: logging.NewStandardLogger(os.Stdout), // Log to stdout
ClientLogMode: aws.LogRequest | aws.LogResponse, // Log headers
Region: "auto", // Must be "auto"
})

// Open local file
file, err := os.Open("demo.mp4") // Local file path
if err != nil {
log.Fatalf("failed to open file: %v", err)
return
}
defer file.Close()

// Upload file to S3
uploader := manager.NewUploader(s3cli, func(u *manager.Uploader) {
u.PartSize = 10 * 1024 * 1024 // Set chunk size to 10MB
u.Concurrency = 5 // Set concurrent chunks
})
result, err := uploader.Upload(context.TODO(), &s3.PutObjectInput{
Bucket: aws.String("bucketid1"), // Bucket ID in VOD Professional
Key: aws.String("upload/demo.mp4"), // File path in bucket
Body: file,
})

if err != nil {
log.Fatalf("failed to upload file: %v", err)
return
}
log.Printf("etag: %s", *result.ETag) // Get uploaded file's ETag
}
// This example is implemented based on AWS SDK for Java v2 service/s3 v2.31.35.
// For AWS SDK for Java 2.30.0 and later versions, S3's default integrity protection must be disabled.
// For more details, refer to: https://github.com/aws/aws-sdk-java-v2/issues/5801
import software.amazon.awssdk.auth.credentials.AwsBasicCredentials;
import software.amazon.awssdk.auth.credentials.StaticCredentialsProvider;
import software.amazon.awssdk.http.nio.netty.NettyNioAsyncHttpClient;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.s3.S3AsyncClient;
import software.amazon.awssdk.services.s3.S3Configuration;
import software.amazon.awssdk.transfer.s3.S3TransferManager;
import software.amazon.awssdk.transfer.s3.model.UploadFileRequest;
import software.amazon.awssdk.transfer.s3.progress.LoggingTransferListener;
import software.amazon.awssdk.core.checksums.RequestChecksumCalculation;
import software.amazon.awssdk.core.checksums.ResponseChecksumValidation;

import java.io.File;
import java.net.URI;
import java.util.concurrent.CompletableFuture;

public class Main {
public static void main(String[] args) {
S3AsyncClient s3AsyncClient = null;
S3TransferManager transferManager = null;

try {
// VOD Professional AccessKeys
AwsBasicCredentials credentials = AwsBasicCredentials.create(
"AccessKeyId", // Your AccessKeyId
"SecretAccessKey" // Your SecretAccessKey
);
String region = "ap-guangzhou"; // Bucket region
String bucketId = "bucketid1"; // Bucket ID
String filePath = "demo.mp4"; // Local file path
String key = "upload/demo.mp4"; // File path in bucket
String endpointUrl = String.format("https://vodsrc-internal.%s.eovod.com", region);

// Build S3 async client
s3AsyncClient = S3AsyncClient.builder()
.credentialsProvider(StaticCredentialsProvider.create(credentials))
.endpointOverride(URI.create(endpointUrl))
.region(Region.of("auto")) // Must be "auto"
.httpClient(NettyNioAsyncHttpClient.builder().build())
.serviceConfiguration(S3Configuration.builder()
.pathStyleAccessEnabled(false) // Disable path style
.build())
.requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED)
.responseChecksumValidation(ResponseChecksumValidation.WHEN_REQUIRED)
.build();

// Create transfer manager
transferManager = S3TransferManager.builder()
.s3Client(s3AsyncClient)
.build();

File fileToUpload = new File(filePath);

// Create upload request
UploadFileRequest uploadRequest = UploadFileRequest.builder()
.putObjectRequest(builder -> builder
.bucket(bucketId)
.key(key))
.addTransferListener(LoggingTransferListener.create())
.source(fileToUpload)
.build();

// Execute upload
CompletableFuture<Void> future = transferManager.uploadFile(uploadRequest)
.completionFuture()
.thenAccept(response -> {
System.out.println("Upload successful! ETag: " + response.response().eTag());
});

future.join();
System.out.println("Upload task completed");
} catch (Exception e) {
System.err.println("Upload failed: " + e.getMessage());
e.printStackTrace();
} finally {
// Cleanup resources
try {
if (transferManager != null) transferManager.close();
if (s3AsyncClient != null) s3AsyncClient.close();
System.out.println("Resources released");
} catch (Exception e) {
System.err.println("Error closing resources: " + e.getMessage());
}
}
}
}
// This example is implemented based on AWS SDK for C++ v1.11.560.
// For AWS SDK for C++ v1.11.486 and later versions, S3's default integrity protection must be disabled.
// For more details, refer to: https://github.com/aws/aws-sdk-cpp/issues/3253
#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentials.h>
#include <aws/core/client/ClientConfiguration.h>
#include <aws/s3/S3Client.h>
#include <aws/transfer/TransferManager.h>
#include <iostream>

int main()
{
// Initialize AWS SDK
Aws::SDKOptions options;
options.loggingOptions.logLevel = Aws::Utils::Logging::LogLevel::Info;
Aws::InitAPI(options);

{
// Configuration
const Aws::String accessKeyId = "AccessKeyId"; // Your AccessKeyId
const Aws::String secretAccessKey = "SecretAccessKey"; // Your SecretAccessKey
const Aws::String region = "ap-guangzhou"; // Bucket region
const Aws::String bucketId = "bucketid1"; // Bucket ID
const Aws::String keyName = "upload/demo.mp4"; // File path in bucket
const Aws::String filePath = "demo.mp4"; // Local file path

// Configure client
Aws::Client::ClientConfiguration clientConfig;
clientConfig.region = "auto"; // Must be "auto"
clientConfig.scheme = Aws::Http::Scheme::HTTPS; // Use HTTPS
clientConfig.enableEndpointDiscovery = false; // Disable endpoint discovery
clientConfig.verifySSL = true; // Enable SSL verification
clientConfig.endpointOverride = "vodsrc-internal." + region + ".eovod.com";
clientConfig.checksumConfig.requestChecksumCalculation = Aws::Client::RequestChecksumCalculation::WHEN_REQUIRED;
clientConfig.checksumConfig.responseChecksumValidation = Aws::Client::ResponseChecksumValidation::WHEN_REQUIRED;

// Set credentials
Aws::Auth::AWSCredentials credentials(accessKeyId, secretAccessKey);

// Create S3 client
auto s3Client = Aws::MakeShared<Aws::S3::S3Client>(
"S3Client",
credentials,
clientConfig,
Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, // Disable payload signing
true // Use virtual addressing
);

// Create executor
auto executor = Aws::MakeShared<Aws::Utils::Threading::PooledThreadExecutor>("executor", 10);

// Configure TransferManager
Aws::Transfer::TransferManagerConfiguration transferConfig(executor.get());
transferConfig.s3Client = s3Client;
transferConfig.bufferSize = 10 * 1024 * 1024; // 10MB chunk size

// Create TransferManager
auto transferManager = Aws::Transfer::TransferManager::Create(transferConfig);

std::cout << "Starting upload: " << filePath << " to " << bucketId << "/" << keyName << std::endl;

// Execute upload
auto uploadHandle = transferManager->UploadFile(
filePath, // Local file path
bucketId, // Bucket ID
keyName, // Object key
"application/octet-stream", // Content type
Aws::Map<Aws::String, Aws::String>() // Metadata
);

// Wait for completion
uploadHandle->WaitUntilFinished();

// Check status
if (uploadHandle->GetStatus() == Aws::Transfer::TransferStatus::COMPLETED)
{
std::cout << "Upload successful!" << std::endl;
}
else
{
auto lastError = uploadHandle->GetLastError();
std::cerr << "Upload failed: " << lastError.GetMessage() << std::endl;
}
}

// Cleanup SDK
Aws::ShutdownAPI(options);
return 0;
}
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import boto3
from botocore.config import Config
from botocore.exceptions import ClientError

# Constants
REGION = "ap-guangzhou" # Bucket region
BUCKET_ID = "bucketid1" # Bucket ID
FILE_PATH = "demo.mp4" # Local file path
OBJECT_KEY = "upload/demo.mp4" # File path in bucket

# Create S3 client
s3_client = boto3.client(
"s3",
aws_access_key_id="AccessKeyId", # Your AccessKeyId
aws_secret_access_key="SecretAccessKey", # Your SecretAccessKey
endpoint_url=f"https://vodsrc-internal.{REGION}.eovod.com", # Bucket endpoint
config=Config(
s3={"addressing_style": "virtual"}, # Use virtual hosted-style
request_checksum_calculation="when_required", # Disable default integrity protection
response_checksum_validation="when_required",
),
)

try:
# Upload file
response = s3_client.upload_file(
Bucket=BUCKET_ID, # Bucket ID
Key=OBJECT_KEY, # File path in bucket
Filename=FILE_PATH, # Local file path
)
print(response)
except ClientError as e:
print(f"Error: {e}")
Note:
Confirm data integrity protection when using AWS SDK.
When using bucket preset internet domains, the path must be in virtual hosted-style format.
문제 해결에 도움이 되었나요?
더 자세한 내용은 문의하기 또는 티켓 제출 을 통해 문의할 수 있습니다.
아니오

피드백