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
-
arnoptional computed - string -
endpointoptional computed - string -
endpoint_typeoptional - string -
force_destroyoptional - bool -
host_keyoptional - string -
host_key_fingerprintoptional computed - string -
idoptional computed - string -
identity_provider_typeoptional - string -
invocation_roleoptional - string -
logging_roleoptional - string -
tagsoptional - map from string to string -
urloptional - string -
endpoint_detailslist block-
address_allocation_idsoptional - set of string -
subnet_idsoptional - set of string -
vpc_endpoint_idoptional computed - string -
vpc_idoptional - string
-
Explanation in Terraform Registry
Provides a AWS Transfer Server resource.
NOTE on AWS IAM permissions: If the
endpoint_typeis set toVPC, theec2:DescribeVpcEndpointsandec2:ModifyVpcEndpointactions 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
-
LoggingRoleoptional - String -
Protocolsoptional - List of Protocol -
IdentityProviderDetailsoptional - IdentityProviderDetails -
EndpointTypeoptional - String -
SecurityPolicyNameoptional - String -
ProtocolDetailsoptional - ProtocolDetails -
WorkflowDetailsoptional - WorkflowDetails -
Domainoptional - String -
EndpointDetailsoptional - EndpointDetails -
IdentityProviderTypeoptional - String -
Tagsoptional - List of Tag -
Certificateoptional - String
Explanation in CloudFormation Registry
The
AWS::Transfer::Serverresource 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-generatedServerIdproperty 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.