AWS Transfer Family Server
This page shows how to write Terraform and CloudFormation for AWS Transfer Family Server and write them securely.
aws_transfer_server (Terraform)
The Server in AWS Transfer Family can be configured in Terraform with the resource name aws_transfer_server
. The following sections describe 5 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "aws_transfer_server" "default_no_protocols" {
tags = {
Name = "No protocols"
}
}
resource "aws_transfer_server" "example_public" {
endpoint_type = "PUBLIC"
protocols = ["SFTP"]
}
# pass
resource "aws_transfer_server" "sftp" {
identity_provider_type = "SERVICE_MANAGED"
}
resource "aws_transfer_server" "transfer_server" {
count = var.enable_sftp && var.endpoint_type == "PUBLIC" ? 1 : 0
identity_provider_type = var.identity_provider_type
logging_role = join("", aws_iam_role.transfer_server_role.*.arn)
force_destroy = false
resource "aws_transfer_server" "server" {
identity_provider_type = "API_GATEWAY"
endpoint_type = "PUBLIC"
invocation_role = aws_iam_role.transfer_IdP_role.arn
url = aws_api_gateway_stage.stage.invoke_url
logging_role = aws_iam_role.SFTPLogsRole.arn
Parameters
-
arn
optional computed - string -
endpoint
optional computed - string -
endpoint_type
optional - string -
force_destroy
optional - bool -
host_key
optional - string -
host_key_fingerprint
optional computed - string -
id
optional computed - string -
identity_provider_type
optional - string -
invocation_role
optional - string -
logging_role
optional - string -
tags
optional - map from string to string -
url
optional - string -
endpoint_details
list block-
address_allocation_ids
optional - set of string -
subnet_ids
optional - set of string -
vpc_endpoint_id
optional computed - string -
vpc_id
optional - string
-
Explanation in Terraform Registry
Provides a AWS Transfer Server resource.
NOTE on AWS IAM permissions: If the
endpoint_type
is set toVPC
, theec2:DescribeVpcEndpoints
andec2:ModifyVpcEndpoint
actions are used.
AWS::Transfer::Server (CloudFormation)
The Server in Transfer can be configured in CloudFormation with the resource name AWS::Transfer::Server
. The following sections describe 10 examples of how to use the resource and its parameters.
Example Usage from GitHub
Type: AWS::Transfer::Server
Properties:
Tags:
-
Key: Name
Value: ${self:provider.environment.namePrefix}sftp
Type: "AWS::Transfer::Server"
DeletionPolicy: "Delete"
DependsOn: "LoggingRole"
Properties:
# EndpointDetails:
# VpcEndpointId: String
Type: AWS::Transfer::Server
DependsOn:
- AccessSftpTransfer
- VpcEndpointSftp
Properties:
EndpointDetails:
Type: AWS::Transfer::Server
Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-transfer-server.html
Outputs:
ServerId:
Value:
GetAtt:
Type: AWS::Transfer::Server
Description: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-transfer-server.html
Outputs:
ServerId:
Value:
GetAtt:
"Type": "AWS::Transfer::Server",
"Properties": {
"EndpointDetails": {
"AddressAllocationIds": [ { "Ref": "SFTPElasticIP" } ],
"SecurityGroupIds" : { "Fn::Split" : [ ",", { "Ref": "SecurityGroupIds" } ] },
"SubnetIds": { "Ref": "SubnetIds" },
"Type": "AWS::Transfer::Server",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "fl-dev-sftp"
"Type": "AWS::Transfer::Server",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "fl-dev-sftp"
"AWS::Transfer::Server.Protocol": {
"PrimitiveType": "String"
},
"Tag": {
"Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html",
"Properties": {
"Type": "AWS::Transfer::Server",
"Properties": {
"EndpointDetails": {
"AddressAllocationIds": [
{
"Fn::GetAtt": [
Parameters
-
LoggingRole
optional - String -
Protocols
optional - List of Protocol -
IdentityProviderDetails
optional - IdentityProviderDetails -
EndpointType
optional - String -
SecurityPolicyName
optional - String -
ProtocolDetails
optional - ProtocolDetails -
WorkflowDetails
optional - WorkflowDetails -
Domain
optional - String -
EndpointDetails
optional - EndpointDetails -
IdentityProviderType
optional - String -
Tags
optional - List of Tag -
Certificate
optional - String
Explanation in CloudFormation Registry
The
AWS::Transfer::Server
resource instantiates an autoscaling virtual server based on a file transfer protocol in AWS. When you make updates to your server or when you work with users, use the service-generatedServerId
property that is assigned to the newly created server.
Frequently asked questions
What is AWS Transfer Family Server?
AWS Transfer Family Server is a resource for Transfer Family of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.
Where can I find the example code for the AWS Transfer Family Server?
For Terraform, the infracost/infracost, bridgecrewio/checkov and heldersepu/hs-scripts source code examples are useful. See the Terraform Example section for further details.
For CloudFormation, the kartik-rao/lib-forms-api, goodbyegangster/cloudformation and Fellipe26/templates-cloudformation source code examples are useful. See the CloudFormation Example section for further details.