Sample code for 30+ languages & platforms
AutoIt

AWS Transfer for SFTP (Amazon S3)

See more SFTP Examples

Once you've setup your AWS Transfer for SFTP in the AWS Console, interacting with it is no different than any other SSH/SFTP server. AWS will provide a private key in PEM format. It is used for authentication (instead of a password).

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oSftp = ObjCreate("Chilkat.SFtp")

; Connect to the AWS SFTP server.
; Change the domain to your value.
Local $sDomain = "s-123456df999999fab.server.transfer.eu-west-2.amazonaws.com"
Local $iPort = 22
$bSuccess = $oSftp.Connect($sDomain,$iPort)
If ($bSuccess = False) Then
    ConsoleWrite($oSftp.LastErrorText & @CRLF)
    Exit
EndIf

; Load your AWS SFTP private key PEM file..
$oSshKey = ObjCreate("Chilkat.SshKey")
Local $sKeyText = $oSshKey.LoadText("qa_data/pem/s3_sftp_privateKey.pem")
If ($oSshKey.LastMethodSuccess <> True) Then
    ConsoleWrite($oSshKey.LastErrorText & @CRLF)
    Exit
EndIf

$bSuccess = $oSshKey.FromOpenSshPrivateKey($sKeyText)
If ($bSuccess = False) Then
    ConsoleWrite($oSshKey.LastErrorText & @CRLF)
    Exit
EndIf

; Authenticate with the SSH server using the private key.
$bSuccess = $oSftp.AuthenticatePk("myUsername",$oSshKey)
If ($bSuccess = False) Then
    ConsoleWrite($oSftp.LastErrorText & @CRLF)
    Exit
EndIf

; After authenticating, the SFTP subsystem must be initialized:
$bSuccess = $oSftp.InitializeSftp()
If ($bSuccess = False) Then
    ConsoleWrite($oSftp.LastErrorText & @CRLF)
    Exit
EndIf

; Upload from the local file to the SSH server.
; Important -- the remote filepath is the 1st argument,
; the local filepath is the 2nd argument;
Local $sRemoteFilePath = "hamlet.xml"
Local $sLocalFilePath = "c:/temp/hamlet.xml"

$bSuccess = $oSftp.UploadFileByName($sRemoteFilePath,$sLocalFilePath)
If ($bSuccess = False) Then
    ConsoleWrite($oSftp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite("Success." & @CRLF)