Amazon S3 using Excel VBA

0

How to download/upload files on PRIVATE buckets in Amazon S3 from Excel VBA? or alternatively, what are VBA instructions to create presigned URLs?

已提問 1 年前檢視次數 578 次
1 個回答
0

hi You can try using the AWS .NET SDK

  1. Install the AWS SDK for .NET
  2. Set up your AWS credentials, including your AWS Access Key and Secret Access Key.
  3. Create an S3 client using the AWS .NET SDK in your VBA code. You will need to provide the client with your AWS credentials and the S3 bucket name.
  4. To upload a file to the S3 bucket, use the PutObject method of the S3 client. You will need to provide the file path, key name (i.e., the name of the file in the bucket), and the bucket name.
  5. To download a file from the S3 bucket, use the GetObject method of the S3 client. You will need to provide the key name and the bucket name.

Sample code to download a file from a private S3 bucket

Sub DownloadFileFromS3()
    Dim s3Client As Object
    Dim response As Object
    Dim keyName As String
    Dim bucketName As String
    Dim localFilePath As String
   
    'Set AWS credentials
    Set s3Client = CreateObject("Amazon.S3.AmazonS3Client")
    s3Client.Initialize("<Your Access Key>", "<Your Secret Key>", "<Region>")
   
    'Set S3 bucket name and key name
    bucketName = "<The bucket name you want to access>"
    keyName = "<Object name>"
   
    'Set local file path to download the file
    localFilePath = "<Local path where the file will be stored>"
   
    'Download the file from S3 bucket
    Set response = s3Client.GetObject(bucketName, keyName)
   
    'Save the downloaded file to local folder
    response.WriteToFile localFilePath
End Sub

Thanks Arun

AWS
Arun
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南