How to Upload Files Using Amazon S3 with FileZilla Pro CLI

What you’ll need

Create a user and get a secret access key for FileZilla Pro CLI

  1. Go to the IAM dashboard at https://console.aws.amazon.com/iam
  2. Select Users from the menu on the left.

  3. Click on Add User.

  4. Enter a user name.
  5. Tick the Programmatic access checkbox.
  6. Click on Next: Permissions.

  7. Click on Attach existing policies directly.
  8. Enter S3 in the policy search field and press ENTER on your keyboard.

  9. Tick the AmazonS3FullAccess policy.

  10. Click on Next: Tags.
  11. Click on Next: Review

  12. Check that you’ve assigned the AmazonS3FullAccess policy.
  13. Click on Create User.

  14. Without closing this browser window – you’ll need the access key information – open FileZilla Pro CLI.

Connecting to S3

Use the s3 protocol and connect to the s3.amazonaws.com host:

From the prompt enter the connect command:

    connect s3://<access key>:<secret key>@s3.amazonaws.com ˓→<path>

Optionally you can use the parameters of the connect command:

    connect --protocol s3 --user <access key> --pass <secret key> --path s3.amazonaws.com

Note that the path is optional but if present it has to start with a slash.

How to use AWS config and credentials files to connect

FileZilla Pro Command Line can also connect using the credentials and settings from the .aws/config and .aws/credentials files.

  1. Use the command site add to create a new site in the Site Manager (see Using the Site Manager).
  2. Select S3 or S3 via IAM Identity Center protocol.
  3. Press enter twice to keep the default host and port.
  4. In the Logon type choose Profile.
  5. In the Profile field enter the configured profile name. For the default profile enter: default.
  6. Continue the site configuration.

FileZilla Pro Command Line supports the following settings:

  • aws_access_key_id
  • aws_secret_access_key
  • region
  • source_profile
  • role_arns
  • role_session_name
  • mfa_serial
  • duration_seconds
  • aws_session_token

If a setting exists both in credentials and config files for the same profile the settings from the credentials file are used. If any of the settings region, role_arn and mfa_serial exist both in the site configuration and in the files, the settings from the files are used.

FileZilla Pro Command Line looks for the AWS_CONFIG_FILE environment variable to locate the config file. Also, it looks for the AWS_SHARED_CREDENTIALS_FILE environment variable to locate the credentials file.

If any of these environment variables are empty, FileZilla Pro Command Line looks for the file in the
.aws directory in the user’s (or home) directory. On Debian you can find the user’s directory with the $HOME environment variable. On Windows you can find the user’s directory with the %USERPROFILE% environment variable.

For more details about these files consult the AWS documentation.

How to authenticate against the AWS IAM Identity Center (formerlym AWS Single Sign-On)

AWS Identity Center provides access to resources without the need for access keys or secret keys.

To connect using the IAM Identity Center:

  1. Use the command site add to create a new site in the Site Manager (see Using the Site Manager).
  2. Select S3 via IAM Identity Center protocol.
  3. Press enter twice to keep the default host and port.
  4. In the Logon type choose either Interactive or Profile.
  5. For Interactive type, enter the AWS account ID in the Account ID prompt.
  6. For Profile, enter a configured profile name. The required profile fields are: sso_account_id, sso_region,sso_role_name and sso_start_url.
  7. Optionally, modify both the local and remote directories when prompted. See How to use AWS config and credentials files to connect.
  8. When asked for advanced options, enter Yes.
  9. In the S3 – SSO – Region prompt, enter the AWS Region that contains the AWS access portal host. This region may be different from the previously entered region.
  10. In the S3 – SSO – Role prompt, enter the role or permission set name.
  11. In the S3 – SSO – URL prompt, enter the URL for the AWS access portal.
  12. The site is now created. To connect use the command:
    site "0/Site name"
  13. The authentication URL will be displayed. Copy and paste it into your browser.
  14. In the browser, IAM Identity Center will prompt you to log in using your IAM credentials.
  15. After logging in, you will be asked to authorize the request.
  16. Click Allow to grant access to FileZilla Pro Command Line.
  17. Return to FileZilla Pro Command Line and press enter to continue.

You are now connected to AWS S3 using IAM Identity Center authentication. For more information, visit https://aws.amazon.com/iam/identity-center

See also: Connect to an existing site

Tags: , , , , , , , ,