Hello all,
Currently, we are testing a simple code to upload files to a specific S3 bucket defined within UiPath Studio. The code we are using is as follows:
Dim folderPath As String = “C:\Users\UatRobot001\Downloads\xxxxxx\yyyyy\Data”
Dim hs As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create()
Dim bucketName As String = “your-robot-bucket-name”
Dim accessKey As String = “secreAccess”
Dim secreteKey As String = “secretKey”
Dim regionEndpoint As Amazon.RegionEndpoint = Amazon.RegionEndpoint.EUCentral1
Dim client As Amazon.S3.AmazonS3Client = New Amazon.S3.AmazonS3Client(accessKey, secreteKey, regionEndpoint)
So far, everything is working fine. We are able to list objects, upload files, and perform other operations. However, since we have already attached an IAM role to our AWS EC2 instance profile, we expect the following code to work:
Dim folderPath As String = “C:\Users\UatRobot001\Downloads\xxxxxx\yyyyy\Data”
Dim hs As System.Security.Cryptography.MD5 = System.Security.Cryptography.MD5.Create()
Dim bucketName As String = “your-robot-bucket-name”
Dim regionEndpoint As Amazon.RegionEndpoint = Amazon.RegionEndpoint.EUCentral1
’ Create the client with the regionEndpoint, assuming we can retrieve the credentials from the instance profile:
Dim client As New Amazon.S3.AmazonS3Client(regionEndpoint)
Unfortunately, this code fails with a “permission denied” error. Please note that if we use the AWS CLI with the attached EC2 instance profile, like:
aws s3 ls your-robot-bucket-name/prefix/blabla
aws s3 cp file.pdf your-robot-bucket-name/prefix/blabla
It works perfectly fine. Therefore, it is evident that the attached IAM role has the necessary permissions.
So, either UiPath Robot is unable to retrieve the correct credentials because our code is incorrect, or maybe this scenario is still not supported?
We also try the following:
Dim regionEndpoint As Amazon.RegionEndpoint = Amazon.RegionEndpoint.EUCentral1
Dim credentials As Amazon.Runtime.AWSCredentials = New Amazon.Runtime.InstanceProfileAWSCredentials()
Dim client As New Amazon.S3.AmazonS3Client(credentials, regionEndpoint)
and
Dim roleName As String = “your-robot-bucket-name”
Dim credentials As Amazon.Runtime.AWSCredentials = New Amazon.Runtime.InstanceProfileAWSCredentials(roleName)
Dim client As Amazon.S3.AmazonS3Client = New Amazon.S3.AmazonS3Client(credentials, regionEndpoint)
Crash! → Permission
Please find the attached error.
Any help or hints would be greatly appreciated. Thank you!