Re: S3 Transfer Automation > The specified bucket does not exist
The only one that doesn't work is when using"/"
as remote directory in the PutFiles method.
You cannot upload to root folder on S3.
The only one that doesn't work is when using"/"
as remote directory in the PutFiles method.
Are you sure it's the*
that "did the trick"? It should work even without the*
:session.PutFiles(LocalDirectoryPath, "/bucketName/", DeleteSourceFiles, transferOptions);
session.PutFiles(LocalDirectoryPath, "*", DeleteSourceFiles, transferOptions);
session.PutFiles(LocalDirectoryPath, "/bucketName/", DeleteSourceFiles, transferOptions);
"/"
as remote directory in the PutFiles method.
I finally got it to work by changing this ligne :session.PutFiles(LocalDirectoryPath, "/", DeleteSourceFiles, transferOptions);
with this one :session.PutFiles(LocalDirectoryPath, "/bucketName/*", DeleteSourceFiles, transferOptions);
The*
did the trick.
*
that "did the trick"? It should work even without the *
:
session.PutFiles(LocalDirectoryPath, "/bucketName/", DeleteSourceFiles, transferOptions);
session.PutFiles(LocalDirectoryPath, "/", DeleteSourceFiles, transferOptions);
session.PutFiles(LocalDirectoryPath, "*", DeleteSourceFiles, transferOptions);
*
did the trick.
sessionOptions.AddRawSettings("RemoteDirectory", "/bucketName");
IN .NET ASSEMBLY
The connection is established correctly but when thePutFiles
is executed it generates an exception.
I triedsessionOptions.AddRawSettings("RemoteDirectory", "/bucket");
but with no success too.SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.S3,
HostName = "s3-eu-west-1.amazonaws.com",
UserName = "*****************",
Password = "***************************",
};
sessionOptions.AddRawSettings("RemoteDirectory", "/<bucketName>");
using (Session session = new Session())
{
session.Open(sessionOptions);
session.PutFiles(LocalDirectoryPath, "/", DeleteSourceFiles, transferOptions);
}
HostName = "s3-eu-west-1.amazonaws.com"
Initial Remote directory = "/<bucketName>"
HostName = "<bucketName>.s3-eu-west-1.amazonaws.com"
Initial Remote directory = "/"
PutFiles
is executed it generates an exception.
sessionOptions.AddRawSettings("RemoteDirectory", "/bucket");
but with no success too.
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.S3,
HostName = "s3-eu-west-1.amazonaws.com",
UserName = "*****************",
Password = "***************************",
};
sessionOptions.AddRawSettings("RemoteDirectory", "/<bucketName>");
using (Session session = new Session())
{
session.Open(sessionOptions);
session.PutFiles(LocalDirectoryPath, "/", DeleteSourceFiles, transferOptions);
}
In the WinSCP UI I have the same behaviour. If I use the following configuration it works :HostName = "s3-eu-west-1.amazonaws.com"
Remote directory = "/<bucketName>"
sessionOptions.AddRawSettings("RemoteDirectory", "/bucket");
session.Open(sessionOptions);
, so before the Session.PutFiles
is executed.
<bucketName>.s3-eu-west-1.amazonaws.com
to bypass that behaviour but it resulted in another weird behaviour which is explained in the first post.
RemoteDirectoryPath
that you pass to Session.PutFiles
. That should be enough.
Session.SessionLogPath
. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.In the WinSCP UI I have the same behaviour. If I use the following configuration it works :HostName = "s3-eu-west-1.amazonaws.com"
Remote directory = "/<bucketName>"
This is the correct solution. So use it in .NET assembly too.
HostName = "s3-eu-west-1.amazonaws.com"
WinSCP.SessionRemoteException: Access denied. Access Denied Extra Details: RequestId: 280C45C8BB312493, HostId: plUn**************rMlQA/pN************CEc/LR8******= Connection failed
In the WinSCP UI I have the same behaviour. If I use the following configuration it works :HostName = "s3-eu-west-1.amazonaws.com"
Remote directory = "/<bucketName>"
// Set up session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.S3,
HostName = "<bucketName>.s3-eu-west-1.amazonaws.com",
UserName = "*****************",
Password = "***************************",
};
using (Session session = new Session())
{
session.Open(sessionOptions);
//logic here
}
The specified bucket does not exist
string LocalDirectoryPath = "C:\path\to\file";
string RemoteDirectoryPath = "/<BucketName>/";
bool DeleteSourceFiles = false;
TransferOptions transferOptions = new TransferOptions();
session.PutFiles(LocalDirectoryPath, RemoteDirectoryPath, DeleteSourceFiles, transferOptions);
WinSCP.SessionRemoteException: Copying files to remote side failed. Specify target bucket
HostName = "s3-eu-west-1.amazonaws.com"
Remote directory = "/<bucketName>"
HostName = "<bucketName>.s3-eu-west-1.amazonaws.com"
Remote directory = "/"
Copying files to remote side failed. Specify target bucket