You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::Transfer::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for AWS Transfer Family. To construct a client, you need to configure a :region and :credentials.

transfer = Aws::Transfer::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::Transfer::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::Transfer::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :active_endpoint_cache (Boolean)

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :disable_host_prefix_injection (Boolean)

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available. See Plugins::EndpointPattern for more details.

  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :endpoint_cache_max_entries (Integer)

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_max_threads (Integer)

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_poll_interval (Integer)

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec. See Plugins::EndpointDiscovery for more details.

  • :endpoint_discovery (Boolean)

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :simple_json (Boolean) — default: false

    Disables request parameter conversion, validation, and formatting. Also disable response data type conversions. This option is useful when you want to ensure the highest level of performance by avoiding overhead of walking request parameters and response data structures.

    When :simple_json is enabled, the request parameters hash must be formatted exactly as the DynamoDB API expects. See Plugins::Protocols::JsonRpc for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#create_server(options = {}) ⇒ Types::CreateServerResponse

Instantiates an autoscaling virtual server based on the selected file transfer protocol in AWS. When you make updates to your file transfer protocol-enabled server or when you work with users, use the service-generated ServerId property that is assigned to the newly created server.

Examples:

Request syntax with placeholder values


resp = client.create_server({
  certificate: "Certificate",
  endpoint_details: {
    address_allocation_ids: ["AddressAllocationId"],
    subnet_ids: ["SubnetId"],
    vpc_endpoint_id: "VpcEndpointId",
    vpc_id: "VpcId",
    security_group_ids: ["SecurityGroupId"],
  },
  endpoint_type: "PUBLIC", # accepts PUBLIC, VPC, VPC_ENDPOINT
  host_key: "HostKey",
  identity_provider_details: {
    url: "Url",
    invocation_role: "Role",
  },
  identity_provider_type: "SERVICE_MANAGED", # accepts SERVICE_MANAGED, API_GATEWAY
  logging_role: "Role",
  protocols: ["SFTP"], # accepts SFTP, FTP, FTPS
  security_policy_name: "SecurityPolicyName",
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue", # required
    },
  ],
})

Response structure


resp.server_id #=> String

Options Hash (options):

  • :certificate (String)

    The Amazon Resource Name (ARN) of the AWS Certificate Manager (ACM) certificate. Required when Protocols is set to FTPS.

    To request a new public certificate, see Request a public certificate in the AWS Certificate Manager User Guide.

    To import an existing certificate into ACM, see Importing certificates into ACM in the AWS Certificate Manager User Guide.

    To request a private certificate to use FTPS through private IP addresses, see Request a private certificate in the AWS Certificate Manager User Guide.

    Certificates with the following cryptographic algorithms and key sizes are supported:

    • 2048-bit RSA (RSA_2048)

    • 4096-bit RSA (RSA_4096)

    • Elliptic Prime Curve 256 bit (EC_prime256v1)

    • Elliptic Prime Curve 384 bit (EC_secp384r1)

    • Elliptic Prime Curve 521 bit (EC_secp521r1)

    The certificate must be a valid SSL/TLS X.509 version 3 certificate with FQDN or IP address specified and information about the issuer.

  • :endpoint_details (Types::EndpointDetails)

    The virtual private cloud (VPC) endpoint settings that are configured for your server. When you host your endpoint within your VPC, you can make it accessible only to resources within your VPC, or you can attach Elastic IPs and make it accessible to clients over the internet. Your VPC\'s default security groups are automatically assigned to your endpoint.

  • :endpoint_type (String)

    The type of VPC endpoint that you want your server to connect to. You can choose to connect to the public internet or a VPC endpoint. With a VPC endpoint, you can restrict access to your server and resources only within your VPC.

    It is recommended that you use VPC as the EndpointType. With this endpoint type, you have the option to directly associate up to three Elastic IPv4 addresses (BYO IP included) with your server\'s endpoint and use VPC security groups to restrict traffic by the client\'s public IP address. This is not possible with EndpointType set to VPC_ENDPOINT.

  • :host_key (String)

    The RSA private key as generated by the ssh-keygen -N "" -m PEM -f my-new-server-key command.

    If you aren\'t planning to migrate existing users from an existing SFTP-enabled server to a new server, don\'t update the host key. Accidentally changing a server\'s host key can be disruptive.

    For more information, see Change the host key for your SFTP-enabled server in the AWS Transfer Family User Guide.

  • :identity_provider_details (Types::IdentityProviderDetails)

    Required when IdentityProviderType is set to API_GATEWAY. Accepts an array containing all of the information required to call a customer-supplied authentication API, including the API Gateway URL. Not required when IdentityProviderType is set to SERVICE_MANAGED.

  • :identity_provider_type (String)

    Specifies the mode of authentication for a server. The default value is SERVICE_MANAGED, which allows you to store and access user credentials within the AWS Transfer Family service. Use the API_GATEWAY value to integrate with an identity provider of your choosing. The API_GATEWAY setting requires you to provide an API Gateway endpoint URL to call for authentication using the IdentityProviderDetails parameter.

  • :logging_role (String)

    Allows the service to write your users\' activity to your Amazon CloudWatch logs for monitoring and auditing purposes.

  • :protocols (Array<String>)

    Specifies the file transfer protocol or protocols over which your file transfer protocol client can connect to your server\'s endpoint. The available protocols are:

    • SFTP (Secure Shell (SSH) File Transfer Protocol): File transfer over SSH

    • FTPS (File Transfer Protocol Secure): File transfer with TLS encryption

    • FTP (File Transfer Protocol): Unencrypted file transfer

    If you select FTPS, you must choose a certificate stored in AWS Certificate Manager (ACM) which will be used to identify your server when clients connect to it over FTPS.

    If Protocol includes either FTP or FTPS, then the EndpointType must be VPC and the IdentityProviderType must be API_GATEWAY.

    If Protocol includes FTP, then AddressAllocationIds cannot be associated.

    If Protocol is set only to SFTP, the EndpointType can be set to PUBLIC and the IdentityProviderType can be set to SERVICE_MANAGED.

  • :security_policy_name (String)

    Specifies the name of the security policy that is attached to the server.

  • :tags (Array<Types::Tag>)

    Key-value pairs that can be used to group and search for servers.

Returns:

See Also:

#create_user(options = {}) ⇒ Types::CreateUserResponse

Creates a user and associates them with an existing file transfer protocol-enabled server. You can only create and associate users with servers that have the IdentityProviderType set to SERVICE_MANAGED. Using parameters for CreateUser, you can specify the user name, set the home directory, store the user's public key, and assign the user's AWS Identity and Access Management (IAM) role. You can also optionally add a scope-down policy, and assign metadata with tags that can be used to group and search for users.

Examples:

Request syntax with placeholder values


resp = client.create_user({
  home_directory: "HomeDirectory",
  home_directory_type: "PATH", # accepts PATH, LOGICAL
  home_directory_mappings: [
    {
      entry: "MapEntry", # required
      target: "MapTarget", # required
    },
  ],
  policy: "Policy",
  role: "Role", # required
  server_id: "ServerId", # required
  ssh_public_key_body: "SshPublicKeyBody",
  tags: [
    {
      key: "TagKey", # required
      value: "TagValue", # required
    },
  ],
  user_name: "UserName", # required
})

Response structure


resp.server_id #=> String
resp.user_name #=> String

Options Hash (options):

  • :home_directory (String)

    The landing directory (folder) for a user when they log in to the server using the client.

    An example is your-Amazon-S3-bucket-name>/home/username .

  • :home_directory_type (String)

    The type of landing directory (folder) you want your users\' home directory to be when they log into the server. If you set it to PATH, the user will see the absolute Amazon S3 bucket paths as is in their file transfer protocol clients. If you set it LOGICAL, you will need to provide mappings in the HomeDirectoryMappings for how you want to make Amazon S3 paths visible to your users.

  • :home_directory_mappings (Array<Types::HomeDirectoryMapEntry>)

    Logical directory mappings that specify what Amazon S3 paths and keys should be visible to your user and how you want to make them visible. You will need to specify the \"Entry\" and \"Target\" pair, where Entry shows how the path is made visible and Target is the actual Amazon S3 path. If you only specify a target, it will be displayed as is. You will need to also make sure that your IAM role provides access to paths in Target. The following is an example.

    '[ "/bucket2/documentation", { "Entry": "your-personal-report.pdf", "Target": "/bucket3/customized-reports/$`{transfer:UserName}`.pdf" } ]'

    In most cases, you can use this value instead of the scope-down policy to lock your user down to the designated home directory (\"chroot\"). To do this, you can set Entry to \'/\' and set Target to the HomeDirectory parameter value.

    If the target of a logical directory entry does not exist in Amazon S3, the entry will be ignored. As a workaround, you can use the Amazon S3 API to create 0 byte objects as place holders for your directory. If using the CLI, use the s3api call instead of s3 so you can use the put-object operation. For example, you use the following: aws s3api put-object --bucket bucketname --key path/to/folder/. Make sure that the end of the key name ends in a \'/\' for it to be considered a folder.

  • :policy (String)

    A scope-down policy for your user so you can use the same IAM role across multiple users. This policy scopes down user access to portions of their Amazon S3 bucket. Variables that you can use inside this policy include $`{Transfer:UserName}`, $`{Transfer:HomeDirectory}`, and $`{Transfer:HomeBucket}`.

    For scope-down policies, AWS Transfer Family stores the policy as a JSON blob, instead of the Amazon Resource Name (ARN) of the policy. You save the policy as a JSON blob and pass it in the Policy argument.

    For an example of a scope-down policy, see Creating a scope-down policy.

    For more information, see AssumeRole in the AWS Security Token Service API Reference.

  • :role (required, String)

    The IAM role that controls your users\' access to your Amazon S3 bucket. The policies attached to this role will determine the level of access you want to provide your users when transferring files into and out of your Amazon S3 bucket or buckets. The IAM role should also contain a trust relationship that allows the server to access your resources when servicing your users\' transfer requests.

  • :server_id (required, String)

    A system-assigned unique identifier for a server instance. This is the specific server that you added your user to.

  • :ssh_public_key_body (String)

    The public portion of the Secure Shell (SSH) key used to authenticate the user to the server.

  • :tags (Array<Types::Tag>)

    Key-value pairs that can be used to group and search for users. Tags are metadata attached to users for any purpose.

  • :user_name (required, String)

    A unique string that identifies a user and is associated with a as specified by the ServerId. This user name must be a minimum of 3 and a maximum of 100 characters long. The following are valid characters: a-z, A-Z, 0-9, underscore \'_\', hyphen \'-\', period \'.\', and at sign \'@\'. The user name can\'t start with a hyphen, period, or at sign.

Returns:

See Also:

#delete_server(options = {}) ⇒ Struct

Deletes the file transfer protocol-enabled server that you specify.

No response returns from this operation.

Examples:

Request syntax with placeholder values


resp = client.delete_server({
  server_id: "ServerId", # required
})

Options Hash (options):

  • :server_id (required, String)

    A unique system-assigned identifier for a server instance.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_ssh_public_key(options = {}) ⇒ Struct

Deletes a user's Secure Shell (SSH) public key.

No response is returned from this operation.

Examples:

Request syntax with placeholder values


resp = client.delete_ssh_public_key({
  server_id: "ServerId", # required
  ssh_public_key_id: "SshPublicKeyId", # required
  user_name: "UserName", # required
})

Options Hash (options):

  • :server_id (required, String)

    A system-assigned unique identifier for a file transfer protocol-enabled server instance that has the user assigned to it.

  • :ssh_public_key_id (required, String)

    A unique identifier used to reference your user\'s specific SSH key.

  • :user_name (required, String)

    A unique string that identifies a user whose public key is being deleted.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_user(options = {}) ⇒ Struct

Deletes the user belonging to a file transfer protocol-enabled server you specify.

No response returns from this operation.

When you delete a user from a server, the user's information is lost.

Examples:

Request syntax with placeholder values


resp = client.delete_user({
  server_id: "ServerId", # required
  user_name: "UserName", # required
})

Options Hash (options):

  • :server_id (required, String)

    A system-assigned unique identifier for a server instance that has the user assigned to it.

  • :user_name (required, String)

    A unique string that identifies a user that is being deleted from a server.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#describe_security_policy(options = {}) ⇒ Types::DescribeSecurityPolicyResponse

Describes the security policy that is attached to your file transfer protocol-enabled server. The response contains a description of the security policy's properties. For more information about security policies, see Working with security policies.

Examples:

Request syntax with placeholder values


resp = client.describe_security_policy({
  security_policy_name: "SecurityPolicyName", # required
})

Response structure


resp.security_policy.fips #=> true/false
resp.security_policy.security_policy_name #=> String
resp.security_policy.ssh_ciphers #=> Array
resp.security_policy.ssh_ciphers[0] #=> String
resp.security_policy.ssh_kexs #=> Array
resp.security_policy.ssh_kexs[0] #=> String
resp.security_policy.ssh_macs #=> Array
resp.security_policy.ssh_macs[0] #=> String
resp.security_policy.tls_ciphers #=> Array
resp.security_policy.tls_ciphers[0] #=> String

Options Hash (options):

  • :security_policy_name (required, String)

    Specifies the name of the security policy that is attached to the server.

Returns:

See Also:

#describe_server(options = {}) ⇒ Types::DescribeServerResponse

Describes a file transfer protocol-enabled server that you specify by passing the ServerId parameter.

The response contains a description of a server's properties. When you set EndpointType to VPC, the response will contain the EndpointDetails.

Examples:

Request syntax with placeholder values


resp = client.describe_server({
  server_id: "ServerId", # required
})

Response structure


resp.server.arn #=> String
resp.server.certificate #=> String
resp.server.endpoint_details.address_allocation_ids #=> Array
resp.server.endpoint_details.address_allocation_ids[0] #=> String
resp.server.endpoint_details.subnet_ids #=> Array
resp.server.endpoint_details.subnet_ids[0] #=> String
resp.server.endpoint_details.vpc_endpoint_id #=> String
resp.server.endpoint_details.vpc_id #=> String
resp.server.endpoint_details.security_group_ids #=> Array
resp.server.endpoint_details.security_group_ids[0] #=> String
resp.server.endpoint_type #=> String, one of "PUBLIC", "VPC", "VPC_ENDPOINT"
resp.server.host_key_fingerprint #=> String
resp.server.identity_provider_details.url #=> String
resp.server.identity_provider_details.invocation_role #=> String
resp.server.identity_provider_type #=> String, one of "SERVICE_MANAGED", "API_GATEWAY"
resp.server.logging_role #=> String
resp.server.protocols #=> Array
resp.server.protocols[0] #=> String, one of "SFTP", "FTP", "FTPS"
resp.server.security_policy_name #=> String
resp.server.server_id #=> String
resp.server.state #=> String, one of "OFFLINE", "ONLINE", "STARTING", "STOPPING", "START_FAILED", "STOP_FAILED"
resp.server.tags #=> Array
resp.server.tags[0].key #=> String
resp.server.tags[0].value #=> String
resp.server.user_count #=> Integer

Options Hash (options):

  • :server_id (required, String)

    A system-assigned unique identifier for a server.

Returns:

See Also:

#describe_user(options = {}) ⇒ Types::DescribeUserResponse

Describes the user assigned to the specific file transfer protocol-enabled server, as identified by its ServerId property.

The response from this call returns the properties of the user associated with the ServerId value that was specified.

Examples:

Request syntax with placeholder values


resp = client.describe_user({
  server_id: "ServerId", # required
  user_name: "UserName", # required
})

Response structure


resp.server_id #=> String
resp.user.arn #=> String
resp.user.home_directory #=> String
resp.user.home_directory_mappings #=> Array
resp.user.home_directory_mappings[0].entry #=> String
resp.user.home_directory_mappings[0].target #=> String
resp.user.home_directory_type #=> String, one of "PATH", "LOGICAL"
resp.user.policy #=> String
resp.user.role #=> String
resp.user.ssh_public_keys #=> Array
resp.user.ssh_public_keys[0].date_imported #=> Time
resp.user.ssh_public_keys[0].ssh_public_key_body #=> String
resp.user.ssh_public_keys[0].ssh_public_key_id #=> String
resp.user.tags #=> Array
resp.user.tags[0].key #=> String
resp.user.tags[0].value #=> String
resp.user.user_name #=> String

Options Hash (options):

  • :server_id (required, String)

    A system-assigned unique identifier for a server that has this user assigned.

  • :user_name (required, String)

    The name of the user assigned to one or more servers. User names are part of the sign-in credentials to use the AWS Transfer Family service and perform file transfer tasks.

Returns:

See Also:

#import_ssh_public_key(options = {}) ⇒ Types::ImportSshPublicKeyResponse

Adds a Secure Shell (SSH) public key to a user account identified by a UserName value assigned to the specific file transfer protocol-enabled server, identified by ServerId.

The response returns the UserName value, the ServerId value, and the name of the SshPublicKeyId.

Examples:

Request syntax with placeholder values


resp = client.import_ssh_public_key({
  server_id: "ServerId", # required
  ssh_public_key_body: "SshPublicKeyBody", # required
  user_name: "UserName", # required
})

Response structure


resp.server_id #=> String
resp.ssh_public_key_id #=> String
resp.user_name #=> String

Options Hash (options):

  • :server_id (required, String)

    A system-assigned unique identifier for a server.

  • :ssh_public_key_body (required, String)

    The public key portion of an SSH key pair.

  • :user_name (required, String)

    The name of the user account that is assigned to one or more servers.

Returns:

See Also:

#list_security_policies(options = {}) ⇒ Types::ListSecurityPoliciesResponse

Lists the security policies that are attached to your file transfer protocol-enabled servers.

Examples:

Request syntax with placeholder values


resp = client.list_security_policies({
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.security_policy_names #=> Array
resp.security_policy_names[0] #=> String

Options Hash (options):

  • :max_results (Integer)

    Specifies the number of security policies to return as a response to the ListSecurityPolicies query.

  • :next_token (String)

    When additional results are obtained from the ListSecurityPolicies command, a NextToken parameter is returned in the output. You can then pass the NextToken parameter in a subsequent command to continue listing additional security policies.

Returns:

See Also:

#list_servers(options = {}) ⇒ Types::ListServersResponse

Lists the file transfer protocol-enabled servers that are associated with your AWS account.

Examples:

Request syntax with placeholder values


resp = client.list_servers({
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.next_token #=> String
resp.servers #=> Array
resp.servers[0].arn #=> String
resp.servers[0].identity_provider_type #=> String, one of "SERVICE_MANAGED", "API_GATEWAY"
resp.servers[0].endpoint_type #=> String, one of "PUBLIC", "VPC", "VPC_ENDPOINT"
resp.servers[0].logging_role #=> String
resp.servers[0].server_id #=> String
resp.servers[0].state #=> String, one of "OFFLINE", "ONLINE", "STARTING", "STOPPING", "START_FAILED", "STOP_FAILED"
resp.servers[0].user_count #=> Integer

Options Hash (options):

  • :max_results (Integer)

    Specifies the number of servers to return as a response to the ListServers query.

  • :next_token (String)

    When additional results are obtained from the ListServers command, a NextToken parameter is returned in the output. You can then pass the NextToken parameter in a subsequent command to continue listing additional servers.

Returns:

See Also:

#list_tags_for_resource(options = {}) ⇒ Types::ListTagsForResourceResponse

Lists all of the tags associated with the Amazon Resource Number (ARN) you specify. The resource can be a user, server, or role.

Examples:

Request syntax with placeholder values


resp = client.list_tags_for_resource({
  arn: "Arn", # required
  max_results: 1,
  next_token: "NextToken",
})

Response structure


resp.arn #=> String
resp.next_token #=> String
resp.tags #=> Array
resp.tags[0].key #=> String
resp.tags[0].value #=> String

Options Hash (options):

  • :arn (required, String)

    Requests the tags associated with a particular Amazon Resource Name (ARN). An ARN is an identifier for a specific AWS resource, such as a server, user, or role.

  • :max_results (Integer)

    Specifies the number of tags to return as a response to the ListTagsForResource request.

  • :next_token (String)

    When you request additional results from the ListTagsForResource operation, a NextToken parameter is returned in the input. You can then pass in a subsequent command to the NextToken parameter to continue listing additional tags.

Returns:

See Also:

#list_users(options = {}) ⇒ Types::ListUsersResponse

Lists the users for a file transfer protocol-enabled server that you specify by passing the ServerId parameter.

Examples:

Request syntax with placeholder values


resp = client.list_users({
  max_results: 1,
  next_token: "NextToken",
  server_id: "ServerId", # required
})

Response structure


resp.next_token #=> String
resp.server_id #=> String
resp.users #=> Array
resp.users[0].arn #=> String
resp.users[0].home_directory #=> String
resp.users[0].home_directory_type #=> String, one of "PATH", "LOGICAL"
resp.users[0].role #=> String
resp.users[0].ssh_public_key_count #=> Integer
resp.users[0].user_name #=> String

Options Hash (options):

  • :max_results (Integer)

    Specifies the number of users to return as a response to the ListUsers request.

  • :next_token (String)

    When you can get additional results from the ListUsers call, a NextToken parameter is returned in the output. You can then pass in a subsequent command to the NextToken parameter to continue listing additional users.

  • :server_id (required, String)

    A system-assigned unique identifier for a server that has users assigned to it.

Returns:

See Also:

#start_server(options = {}) ⇒ Struct

Changes the state of a file transfer protocol-enabled server from OFFLINE to ONLINE. It has no impact on a server that is already ONLINE. An ONLINE server can accept and process file transfer jobs.

The state of STARTING indicates that the server is in an intermediate state, either not fully able to respond, or not fully online. The values of START_FAILED can indicate an error condition.

No response is returned from this call.

Examples:

Request syntax with placeholder values


resp = client.start_server({
  server_id: "ServerId", # required
})

Options Hash (options):

  • :server_id (required, String)

    A system-assigned unique identifier for a server that you start.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#stop_server(options = {}) ⇒ Struct

Changes the state of a file transfer protocol-enabled server from ONLINE to OFFLINE. An OFFLINE server cannot accept and process file transfer jobs. Information tied to your server, such as server and user properties, are not affected by stopping your server.

Stopping the server will not reduce or impact your file transfer protocol endpoint billing; you must delete the server to stop being billed.

The state of STOPPING indicates that the server is in an intermediate state, either not fully able to respond, or not fully offline. The values of STOP_FAILED can indicate an error condition.

No response is returned from this call.

Examples:

Request syntax with placeholder values


resp = client.stop_server({
  server_id: "ServerId", # required
})

Options Hash (options):

  • :server_id (required, String)

    A system-assigned unique identifier for a server that you stopped.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#tag_resource(options = {}) ⇒ Struct

Attaches a key-value pair to a resource, as identified by its Amazon Resource Name (ARN). Resources are users, servers, roles, and other entities.

There is no response returned from this call.

Examples:

Request syntax with placeholder values


resp = client.tag_resource({
  arn: "Arn", # required
  tags: [ # required
    {
      key: "TagKey", # required
      value: "TagValue", # required
    },
  ],
})

Options Hash (options):

  • :arn (required, String)

    An Amazon Resource Name (ARN) for a specific AWS resource, such as a server, user, or role.

  • :tags (required, Array<Types::Tag>)

    Key-value pairs assigned to ARNs that you can use to group and search for resources by type. You can attach this metadata to user accounts for any purpose.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#test_identity_provider(options = {}) ⇒ Types::TestIdentityProviderResponse

If the IdentityProviderType of a file transfer protocol-enabled server is API_Gateway, tests whether your API Gateway is set up successfully. We highly recommend that you call this operation to test your authentication method as soon as you create your server. By doing so, you can troubleshoot issues with the API Gateway integration to ensure that your users can successfully use the service.

Examples:

Request syntax with placeholder values


resp = client.test_identity_provider({
  server_id: "ServerId", # required
  server_protocol: "SFTP", # accepts SFTP, FTP, FTPS
  source_ip: "SourceIp",
  user_name: "UserName", # required
  user_password: "UserPassword",
})

Response structure


resp.response #=> String
resp.status_code #=> Integer
resp.message #=> String
resp.url #=> String

Options Hash (options):

  • :server_id (required, String)

    A system-assigned identifier for a specific server. That server\'s user authentication method is tested with a user name and password.

  • :server_protocol (String)

    The type of file transfer protocol to be tested.

    The available protocols are:

    • Secure Shell (SSH) File Transfer Protocol (SFTP)

    • File Transfer Protocol Secure (FTPS)

    • File Transfer Protocol (FTP)

  • :source_ip (String)

    The source IP address of the user account to be tested.

  • :user_name (required, String)

    The name of the user account to be tested.

  • :user_password (String)

    The password of the user account to be tested.

Returns:

See Also:

#untag_resource(options = {}) ⇒ Struct

Detaches a key-value pair from a resource, as identified by its Amazon Resource Name (ARN). Resources are users, servers, roles, and other entities.

No response is returned from this call.

Examples:

Request syntax with placeholder values


resp = client.untag_resource({
  arn: "Arn", # required
  tag_keys: ["TagKey"], # required
})

Options Hash (options):

  • :arn (required, String)

    The value of the resource that will have the tag removed. An Amazon Resource Name (ARN) is an identifier for a specific AWS resource, such as a server, user, or role.

  • :tag_keys (required, Array<String>)

    TagKeys are key-value pairs assigned to ARNs that can be used to group and search for resources by type. This metadata can be attached to resources for any purpose.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#update_server(options = {}) ⇒ Types::UpdateServerResponse

Updates the file transfer protocol-enabled server's properties after that server has been created.

The UpdateServer call returns the ServerId of the server you updated.

Examples:

Request syntax with placeholder values


resp = client.update_server({
  certificate: "Certificate",
  endpoint_details: {
    address_allocation_ids: ["AddressAllocationId"],
    subnet_ids: ["SubnetId"],
    vpc_endpoint_id: "VpcEndpointId",
    vpc_id: "VpcId",
    security_group_ids: ["SecurityGroupId"],
  },
  endpoint_type: "PUBLIC", # accepts PUBLIC, VPC, VPC_ENDPOINT
  host_key: "HostKey",
  identity_provider_details: {
    url: "Url",
    invocation_role: "Role",
  },
  logging_role: "NullableRole",
  protocols: ["SFTP"], # accepts SFTP, FTP, FTPS
  security_policy_name: "SecurityPolicyName",
  server_id: "ServerId", # required
})

Response structure


resp.server_id #=> String

Options Hash (options):

  • :certificate (String)

    The Amazon Resource Name (ARN) of the AWS Certificate Manager (ACM) certificate. Required when Protocols is set to FTPS.

    To request a new public certificate, see Request a public certificate in the AWS Certificate Manager User Guide.

    To import an existing certificate into ACM, see Importing certificates into ACM in the AWS Certificate Manager User Guide.

    To request a private certificate to use FTPS through private IP addresses, see Request a private certificate in the AWS Certificate Manager User Guide.

    Certificates with the following cryptographic algorithms and key sizes are supported:

    • 2048-bit RSA (RSA_2048)

    • 4096-bit RSA (RSA_4096)

    • Elliptic Prime Curve 256 bit (EC_prime256v1)

    • Elliptic Prime Curve 384 bit (EC_secp384r1)

    • Elliptic Prime Curve 521 bit (EC_secp521r1)

    The certificate must be a valid SSL/TLS X.509 version 3 certificate with FQDN or IP address specified and information about the issuer.

  • :endpoint_details (Types::EndpointDetails)

    The virtual private cloud (VPC) endpoint settings that are configured for your server. With a VPC endpoint, you can restrict access to your server to resources only within your VPC. To control incoming internet traffic, you will need to associate one or more Elastic IP addresses with your server\'s endpoint.

  • :endpoint_type (String)

    The type of endpoint that you want your server to connect to. You can choose to connect to the public internet or a VPC endpoint. With a VPC endpoint, you can restrict access to your server and resources only within your VPC.

    It is recommended that you use VPC as the EndpointType. With this endpoint type, you have the option to directly associate up to three Elastic IPv4 addresses (BYO IP included) with your server\'s endpoint and use VPC security groups to restrict traffic by the client\'s public IP address. This is not possible with EndpointType set to VPC_ENDPOINT.

  • :host_key (String)

    The RSA private key as generated by ssh-keygen -N "" -m PEM -f my-new-server-key.

    If you aren\'t planning to migrate existing users from an existing server to a new server, don\'t update the host key. Accidentally changing a server\'s host key can be disruptive.

    For more information, see Change the host key for your SFTP-enabled server in the AWS Transfer Family User Guide.

  • :identity_provider_details (Types::IdentityProviderDetails)

    An array containing all of the information required to call a customer\'s authentication API method.

  • :logging_role (String)

    Changes the AWS Identity and Access Management (IAM) role that allows Amazon S3 events to be logged in Amazon CloudWatch, turning logging on or off.

  • :protocols (Array<String>)

    Specifies the file transfer protocol or protocols over which your file transfer protocol client can connect to your server\'s endpoint. The available protocols are:

    • Secure Shell (SSH) File Transfer Protocol (SFTP): File transfer over SSH

    • File Transfer Protocol Secure (FTPS): File transfer with TLS encryption

    • File Transfer Protocol (FTP): Unencrypted file transfer

    If you select FTPS, you must choose a certificate stored in AWS Certificate Manager (ACM) which will be used to identify your server when clients connect to it over FTPS.

    If Protocol includes either FTP or FTPS, then the EndpointType must be VPC and the IdentityProviderType must be API_GATEWAY.

    If Protocol includes FTP, then AddressAllocationIds cannot be associated.

    If Protocol is set only to SFTP, the EndpointType can be set to PUBLIC and the IdentityProviderType can be set to SERVICE_MANAGED.

  • :security_policy_name (String)

    Specifies the name of the security policy that is attached to the server.

  • :server_id (required, String)

    A system-assigned unique identifier for a server instance that the user account is assigned to.

Returns:

See Also:

#update_user(options = {}) ⇒ Types::UpdateUserResponse

Assigns new properties to a user. Parameters you pass modify any or all of the following: the home directory, role, and policy for the UserName and ServerId you specify.

The response returns the ServerId and the UserName for the updated user.

Examples:

Request syntax with placeholder values


resp = client.update_user({
  home_directory: "HomeDirectory",
  home_directory_type: "PATH", # accepts PATH, LOGICAL
  home_directory_mappings: [
    {
      entry: "MapEntry", # required
      target: "MapTarget", # required
    },
  ],
  policy: "Policy",
  role: "Role",
  server_id: "ServerId", # required
  user_name: "UserName", # required
})

Response structure


resp.server_id #=> String
resp.user_name #=> String

Options Hash (options):

  • :home_directory (String)

    Specifies the landing directory (folder) for a user when they log in to the server using their file transfer protocol client.

    An example is your-Amazon-S3-bucket-name>/home/username.

  • :home_directory_type (String)

    The type of landing directory (folder) you want your users\' home directory to be when they log into the server. If you set it to PATH, the user will see the absolute Amazon S3 bucket paths as is in their file transfer protocol clients. If you set it LOGICAL, you will need to provide mappings in the HomeDirectoryMappings for how you want to make Amazon S3 paths visible to your users.

  • :home_directory_mappings (Array<Types::HomeDirectoryMapEntry>)

    Logical directory mappings that specify what Amazon S3 paths and keys should be visible to your user and how you want to make them visible. You will need to specify the \"Entry\" and \"Target\" pair, where Entry shows how the path is made visible and Target is the actual Amazon S3 path. If you only specify a target, it will be displayed as is. You will need to also make sure that your IAM role provides access to paths in Target. The following is an example.

    '[ "/bucket2/documentation", { "Entry": "your-personal-report.pdf", "Target": "/bucket3/customized-reports/$`{transfer:UserName}`.pdf" } ]'

    In most cases, you can use this value instead of the scope-down policy to lock your user down to the designated home directory (\"chroot\"). To do this, you can set Entry to \'/\' and set Target to the HomeDirectory parameter value.

    If the target of a logical directory entry does not exist in Amazon S3, the entry will be ignored. As a workaround, you can use the Amazon S3 API to create 0 byte objects as place holders for your directory. If using the CLI, use the s3api call instead of s3 so you can use the put-object operation. For example, you use the following: aws s3api put-object --bucket bucketname --key path/to/folder/. Make sure that the end of the key name ends in a / for it to be considered a folder.

  • :policy (String)

    Allows you to supply a scope-down policy for your user so you can use the same IAM role across multiple users. The policy scopes down user access to portions of your Amazon S3 bucket. Variables you can use inside this policy include $`{Transfer:UserName}`, $`{Transfer:HomeDirectory}`, and $`{Transfer:HomeBucket}`.

    For scope-down policies, AWS Transfer Family stores the policy as a JSON blob, instead of the Amazon Resource Name (ARN) of the policy. You save the policy as a JSON blob and pass it in the Policy argument.

    For an example of a scope-down policy, see Creating a scope-down policy.

    For more information, see AssumeRole in the AWS Security Token Service API Reference.

  • :role (String)

    The IAM role that controls your users\' access to your Amazon S3 bucket. The policies attached to this role will determine the level of access you want to provide your users when transferring files into and out of your Amazon S3 bucket or buckets. The IAM role should also contain a trust relationship that allows the server to access your resources when servicing your users\' transfer requests.

  • :server_id (required, String)

    A system-assigned unique identifier for a server instance that the user account is assigned to.

  • :user_name (required, String)

    A unique string that identifies a user and is associated with a server as specified by the ServerId. This user name must be a minimum of 3 and a maximum of 100 characters long. The following are valid characters: a-z, A-Z, 0-9, underscore \'_\', hyphen \'-\', period \'.\', and at sign \'@\'. The user name can\'t start with a hyphen, period, or at sign.

Returns:

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

  • params (Hash) (defaults to: {})

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:

Returns:

  • (Array<Symbol>)

    the list of supported waiters.