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?

질문됨 일 년 전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
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠