Server class
Provides a AWS Transfer Server resource.
> NOTE on AWS IAM permissions: If the endpointType is set to VPC, the ec2:DescribeVpcEndpoints and ec2:ModifyVpcEndpoint actions are used.
> NOTE: Use the aws.transfer.Tag resource to manage the system tags used for custom hostnames.
Example Usage
Basic
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.transfer.Server("example", {tags: {
Name: "Example",
}});
import pulumi
import pulumi_aws as aws
example = aws.transfer.Server("example", tags={
"Name": "Example",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Transfer.Server("example", new()
{
Tags =
{
{ "Name", "Example" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/transfer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := transfer.NewServer(ctx, "example", &transfer.ServerArgs{
Tags: pulumi.StringMap{
"Name": pulumi.String("Example"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_transfer_server" "example" {
tags = {
"Name" = "Example"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.transfer.Server;
import com.pulumi.aws.transfer.ServerArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Server("example", ServerArgs.builder()
.tags(Map.of("Name", "Example"))
.build());
}
}
resources:
example:
type: aws:transfer:Server
properties:
tags:
Name: Example
Security Policy Name
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.transfer.Server("example", {securityPolicyName: "TransferSecurityPolicy-2020-06"});
import pulumi
import pulumi_aws as aws
example = aws.transfer.Server("example", security_policy_name="TransferSecurityPolicy-2020-06")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Transfer.Server("example", new()
{
SecurityPolicyName = "TransferSecurityPolicy-2020-06",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/transfer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := transfer.NewServer(ctx, "example", &transfer.ServerArgs{
SecurityPolicyName: pulumi.String("TransferSecurityPolicy-2020-06"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_transfer_server" "example" {
security_policy_name = "TransferSecurityPolicy-2020-06"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.transfer.Server;
import com.pulumi.aws.transfer.ServerArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Server("example", ServerArgs.builder()
.securityPolicyName("TransferSecurityPolicy-2020-06")
.build());
}
}
resources:
example:
type: aws:transfer:Server
properties:
securityPolicyName: TransferSecurityPolicy-2020-06
VPC Endpoint
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.transfer.Server("example", {
endpointDetails: {
addressAllocationIds: [exampleAwsEip.id],
subnetIds: [exampleAwsSubnet.id],
vpcId: exampleAwsVpc.id,
},
endpointType: "VPC",
});
import pulumi
import pulumi_aws as aws
example = aws.transfer.Server("example",
endpoint_details={
"address_allocation_ids": [example_aws_eip["id"]],
"subnet_ids": [example_aws_subnet["id"]],
"vpc_id": example_aws_vpc["id"],
},
endpoint_type="VPC")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Transfer.Server("example", new()
{
EndpointDetails = new Aws.Transfer.Inputs.ServerEndpointDetailsArgs
{
AddressAllocationIds = new[]
{
exampleAwsEip.Id,
},
SubnetIds = new[]
{
exampleAwsSubnet.Id,
},
VpcId = exampleAwsVpc.Id,
},
EndpointType = "VPC",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/transfer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := transfer.NewServer(ctx, "example", &transfer.ServerArgs{
EndpointDetails: &transfer.ServerEndpointDetailsArgs{
AddressAllocationIds: pulumi.StringArray{
exampleAwsEip.Id,
},
SubnetIds: pulumi.StringArray{
exampleAwsSubnet.Id,
},
VpcId: pulumi.Any(exampleAwsVpc.Id),
},
EndpointType: pulumi.String("VPC"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_transfer_server" "example" {
endpoint_details = {
address_allocation_ids = [exampleAwsEip.id]
subnet_ids = [exampleAwsSubnet.id]
vpc_id = exampleAwsVpc.id
}
endpoint_type = "VPC"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.transfer.Server;
import com.pulumi.aws.transfer.ServerArgs;
import com.pulumi.aws.transfer.inputs.ServerEndpointDetailsArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Server("example", ServerArgs.builder()
.endpointDetails(ServerEndpointDetailsArgs.builder()
.addressAllocationIds(exampleAwsEip.id())
.subnetIds(exampleAwsSubnet.id())
.vpcId(exampleAwsVpc.id())
.build())
.endpointType("VPC")
.build());
}
}
resources:
example:
type: aws:transfer:Server
properties:
endpointDetails:
addressAllocationIds:
- ${exampleAwsEip.id}
subnetIds:
- ${exampleAwsSubnet.id}
vpcId: ${exampleAwsVpc.id}
endpointType: VPC
AWS Directory authentication
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.transfer.Server("example", {
identityProviderType: "AWS_DIRECTORY_SERVICE",
directoryId: exampleAwsDirectoryServiceDirectory.id,
});
import pulumi
import pulumi_aws as aws
example = aws.transfer.Server("example",
identity_provider_type="AWS_DIRECTORY_SERVICE",
directory_id=example_aws_directory_service_directory["id"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Transfer.Server("example", new()
{
IdentityProviderType = "AWS_DIRECTORY_SERVICE",
DirectoryId = exampleAwsDirectoryServiceDirectory.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/transfer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := transfer.NewServer(ctx, "example", &transfer.ServerArgs{
IdentityProviderType: pulumi.String("AWS_DIRECTORY_SERVICE"),
DirectoryId: pulumi.Any(exampleAwsDirectoryServiceDirectory.Id),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_transfer_server" "example" {
identity_provider_type = "AWS_DIRECTORY_SERVICE"
directory_id = exampleAwsDirectoryServiceDirectory.id
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.transfer.Server;
import com.pulumi.aws.transfer.ServerArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Server("example", ServerArgs.builder()
.identityProviderType("AWS_DIRECTORY_SERVICE")
.directoryId(exampleAwsDirectoryServiceDirectory.id())
.build());
}
}
resources:
example:
type: aws:transfer:Server
properties:
identityProviderType: AWS_DIRECTORY_SERVICE
directoryId: ${exampleAwsDirectoryServiceDirectory.id}
AWS Lambda authentication
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.transfer.Server("example", {
identityProviderType: "AWS_LAMBDA",
"function": exampleAwsLambdaFunction.arn,
});
import pulumi
import pulumi_aws as aws
example = aws.transfer.Server("example",
identity_provider_type="AWS_LAMBDA",
function=example_aws_lambda_function["arn"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Transfer.Server("example", new()
{
IdentityProviderType = "AWS_LAMBDA",
Function = exampleAwsLambdaFunction.Arn,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/transfer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := transfer.NewServer(ctx, "example", &transfer.ServerArgs{
IdentityProviderType: pulumi.String("AWS_LAMBDA"),
Function: pulumi.Any(exampleAwsLambdaFunction.Arn),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_transfer_server" "example" {
identity_provider_type = "AWS_LAMBDA"
function = exampleAwsLambdaFunction.arn
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.transfer.Server;
import com.pulumi.aws.transfer.ServerArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Server("example", ServerArgs.builder()
.identityProviderType("AWS_LAMBDA")
.function(exampleAwsLambdaFunction.arn())
.build());
}
}
resources:
example:
type: aws:transfer:Server
properties:
identityProviderType: AWS_LAMBDA
function: ${exampleAwsLambdaFunction.arn}
Protocols
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.transfer.Server("example", {
endpointDetails: {
subnetIds: [exampleAwsSubnet.id],
vpcId: exampleAwsVpc.id,
},
endpointType: "VPC",
protocols: [
"FTP",
"FTPS",
],
certificate: exampleAwsAcmCertificate.arn,
identityProviderType: "API_GATEWAY",
url: `${exampleAwsApiGatewayDeployment.invokeUrl}${exampleAwsApiGatewayResource.path}`,
});
import pulumi
import pulumi_aws as aws
example = aws.transfer.Server("example",
endpoint_details={
"subnet_ids": [example_aws_subnet["id"]],
"vpc_id": example_aws_vpc["id"],
},
endpoint_type="VPC",
protocols=[
"FTP",
"FTPS",
],
certificate=example_aws_acm_certificate["arn"],
identity_provider_type="API_GATEWAY",
url=f"{example_aws_api_gateway_deployment['invokeUrl']}{example_aws_api_gateway_resource['path']}")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Transfer.Server("example", new()
{
EndpointDetails = new Aws.Transfer.Inputs.ServerEndpointDetailsArgs
{
SubnetIds = new[]
{
exampleAwsSubnet.Id,
},
VpcId = exampleAwsVpc.Id,
},
EndpointType = "VPC",
Protocols = new[]
{
"FTP",
"FTPS",
},
Certificate = exampleAwsAcmCertificate.Arn,
IdentityProviderType = "API_GATEWAY",
Url = $"{exampleAwsApiGatewayDeployment.InvokeUrl}{exampleAwsApiGatewayResource.Path}",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/transfer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := transfer.NewServer(ctx, "example", &transfer.ServerArgs{
EndpointDetails: &transfer.ServerEndpointDetailsArgs{
SubnetIds: pulumi.StringArray{
exampleAwsSubnet.Id,
},
VpcId: pulumi.Any(exampleAwsVpc.Id),
},
EndpointType: pulumi.String("VPC"),
Protocols: pulumi.StringArray{
pulumi.String("FTP"),
pulumi.String("FTPS"),
},
Certificate: pulumi.Any(exampleAwsAcmCertificate.Arn),
IdentityProviderType: pulumi.String("API_GATEWAY"),
Url: pulumi.Sprintf("%v%v", exampleAwsApiGatewayDeployment.InvokeUrl, exampleAwsApiGatewayResource.Path),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_transfer_server" "example" {
endpoint_details = {
subnet_ids = [exampleAwsSubnet.id]
vpc_id = exampleAwsVpc.id
}
endpoint_type = "VPC"
protocols = ["FTP", "FTPS"]
certificate = exampleAwsAcmCertificate.arn
identity_provider_type = "API_GATEWAY"
url ="${exampleAwsApiGatewayDeployment.invokeUrl}${exampleAwsApiGatewayResource.path}"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.transfer.Server;
import com.pulumi.aws.transfer.ServerArgs;
import com.pulumi.aws.transfer.inputs.ServerEndpointDetailsArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Server("example", ServerArgs.builder()
.endpointDetails(ServerEndpointDetailsArgs.builder()
.subnetIds(exampleAwsSubnet.id())
.vpcId(exampleAwsVpc.id())
.build())
.endpointType("VPC")
.protocols(
"FTP",
"FTPS")
.certificate(exampleAwsAcmCertificate.arn())
.identityProviderType("API_GATEWAY")
.url(String.format("%s%s", exampleAwsApiGatewayDeployment.invokeUrl(),exampleAwsApiGatewayResource.path()))
.build());
}
}
resources:
example:
type: aws:transfer:Server
properties:
endpointDetails:
subnetIds:
- ${exampleAwsSubnet.id}
vpcId: ${exampleAwsVpc.id}
endpointType: VPC
protocols:
- FTP
- FTPS
certificate: ${exampleAwsAcmCertificate.arn}
identityProviderType: API_GATEWAY
url: ${exampleAwsApiGatewayDeployment.invokeUrl}${exampleAwsApiGatewayResource.path}
Using Structured Logging Destinations
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const transfer = new aws.cloudwatch.LogGroup("transfer", {namePrefix: "transfer_test_"});
const transferAssumeRole = aws.iam.getPolicyDocument({
statements: [{
principals: [{
type: "Service",
identifiers: ["transfer.amazonaws.com"],
}],
effect: "Allow",
actions: ["sts:AssumeRole"],
}],
});
const iamForTransfer = new aws.iam.Role("iam_for_transfer", {
namePrefix: "iam_for_transfer_",
assumeRolePolicy: transferAssumeRole.then(transferAssumeRole => transferAssumeRole.json),
managedPolicyArns: ["arn:aws:iam::aws:policy/service-role/AWSTransferLoggingAccess"],
});
const transferServer = new aws.transfer.Server("transfer", {
endpointType: "PUBLIC",
loggingRole: iamForTransfer.arn,
protocols: ["SFTP"],
structuredLogDestinations: [pulumi.interpolate`${transfer.arn}:*`],
});
import pulumi
import pulumi_aws as aws
transfer = aws.cloudwatch.LogGroup("transfer", name_prefix="transfer_test_")
transfer_assume_role = aws.iam.get_policy_document(statements=[{
"principals": [{
"type": "Service",
"identifiers": ["transfer.amazonaws.com"],
}],
"effect": "Allow",
"actions": ["sts:AssumeRole"],
}])
iam_for_transfer = aws.iam.Role("iam_for_transfer",
name_prefix="iam_for_transfer_",
assume_role_policy=transfer_assume_role.json,
managed_policy_arns=["arn:aws:iam::aws:policy/service-role/AWSTransferLoggingAccess"])
transfer_server = aws.transfer.Server("transfer",
endpoint_type="PUBLIC",
logging_role=iam_for_transfer.arn,
protocols=["SFTP"],
structured_log_destinations=[transfer.arn.apply(lambda arn: f"{arn}:*")])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var transfer = new Aws.CloudWatch.LogGroup("transfer", new()
{
NamePrefix = "transfer_test_",
});
var transferAssumeRole = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"transfer.amazonaws.com",
},
},
},
Effect = "Allow",
Actions = new[]
{
"sts:AssumeRole",
},
},
},
});
var iamForTransfer = new Aws.Iam.Role("iam_for_transfer", new()
{
NamePrefix = "iam_for_transfer_",
AssumeRolePolicy = transferAssumeRole.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
ManagedPolicyArns = new[]
{
"arn:aws:iam::aws:policy/service-role/AWSTransferLoggingAccess",
},
});
var transferServer = new Aws.Transfer.Server("transfer", new()
{
EndpointType = "PUBLIC",
LoggingRole = iamForTransfer.Arn,
Protocols = new[]
{
"SFTP",
},
StructuredLogDestinations = new[]
{
transfer.Arn.Apply(arn => $"{arn}:*"),
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/cloudwatch"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/transfer"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
transfer2, err := cloudwatch.NewLogGroup(ctx, "transfer", &cloudwatch.LogGroupArgs{
NamePrefix: pulumi.String("transfer_test_"),
})
if err != nil {
return err
}
transferAssumeRole, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Service",
Identifiers: []string{
"transfer.amazonaws.com",
},
},
},
Effect: pulumi.StringRef("Allow"),
Actions: []string{
"sts:AssumeRole",
},
},
},
}, nil)
if err != nil {
return err
}
iamForTransfer, err := iam.NewRole(ctx, "iam_for_transfer", &iam.RoleArgs{
NamePrefix: pulumi.String("iam_for_transfer_"),
AssumeRolePolicy: pulumi.String(transferAssumeRole.Json),
ManagedPolicyArns: pulumi.StringArray{
pulumi.String("arn:aws:iam::aws:policy/service-role/AWSTransferLoggingAccess"),
},
})
if err != nil {
return err
}
_, err = transfer.NewServer(ctx, "transfer", &transfer.ServerArgs{
EndpointType: pulumi.String("PUBLIC"),
LoggingRole: iamForTransfer.Arn,
Protocols: pulumi.StringArray{
pulumi.String("SFTP"),
},
StructuredLogDestinations: pulumi.StringArray{
transfer2.Arn.ApplyT(func(arn string) (string, error) {
return fmt.Sprintf("%v:*", arn), nil
}).(pulumi.StringOutput),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_iam_getpolicydocument" "transferAssumeRole" {
statements {
principals {
type = "Service"
identifiers = ["transfer.amazonaws.com"]
}
effect = "Allow"
actions = ["sts:AssumeRole"]
}
}
resource "aws_cloudwatch_loggroup" "transfer" {
name_prefix = "transfer_test_"
}
resource "aws_iam_role" "iam_for_transfer" {
name_prefix = "iam_for_transfer_"
assume_role_policy = data.aws_iam_getpolicydocument.transferAssumeRole.json
managed_policy_arns = ["arn:aws:iam::aws:policy/service-role/AWSTransferLoggingAccess"]
}
resource "aws_transfer_server" "transfer" {
endpoint_type = "PUBLIC"
logging_role = aws_iam_role.iam_for_transfer.arn
protocols = ["SFTP"]
structured_log_destinations = ["${aws_cloudwatch_loggroup.transfer.arn}:*"]
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.cloudwatch.LogGroup;
import com.pulumi.aws.cloudwatch.LogGroupArgs;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.transfer.Server;
import com.pulumi.aws.transfer.ServerArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var transfer = new LogGroup("transfer", LogGroupArgs.builder()
.namePrefix("transfer_test_")
.build());
final var transferAssumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("transfer.amazonaws.com")
.build())
.effect("Allow")
.actions("sts:AssumeRole")
.build())
.build());
var iamForTransfer = new Role("iamForTransfer", RoleArgs.builder()
.namePrefix("iam_for_transfer_")
.assumeRolePolicy(transferAssumeRole.json())
.managedPolicyArns("arn:aws:iam::aws:policy/service-role/AWSTransferLoggingAccess")
.build());
var transferServer = new Server("transferServer", ServerArgs.builder()
.endpointType("PUBLIC")
.loggingRole(iamForTransfer.arn())
.protocols("SFTP")
.structuredLogDestinations(transfer.arn().applyValue(_arn -> String.format("%s:*", _arn)))
.build());
}
}
resources:
transfer:
type: aws:cloudwatch:LogGroup
properties:
namePrefix: transfer_test_
iamForTransfer:
type: aws:iam:Role
name: iam_for_transfer
properties:
namePrefix: iam_for_transfer_
assumeRolePolicy: ${transferAssumeRole.json}
managedPolicyArns:
- arn:aws:iam::aws:policy/service-role/AWSTransferLoggingAccess
transferServer:
type: aws:transfer:Server
name: transfer
properties:
endpointType: PUBLIC
loggingRole: ${iamForTransfer.arn}
protocols:
- SFTP
structuredLogDestinations:
- ${transfer.arn}:*
variables:
transferAssumeRole:
fn::invoke:
function: aws:iam:getPolicyDocument
arguments:
statements:
- principals:
- type: Service
identifiers:
- transfer.amazonaws.com
effect: Allow
actions:
- sts:AssumeRole
Import
In Terraform v1.5.0 and later, use an import Block to import Transfer Servers using the server id. For example:
Using pulumi import, import Transfer Servers using the server id. For example:
$ pulumi import aws:transfer/server:Server example s-12345678
Certain resource arguments, such as hostKey, cannot be read via the API and imported into the provider. This provider will display a difference for these arguments the first run after import if declared in the provider configuration for an imported resource.
Constructors
- Server(String name, {ServerArgs? args, CustomResourceOptions? options})
-
Creates a new Server.
nameThe Pulumi resource name.argsArguments used to configure this Server. The set of arguments for Server.optionsResource options controlling this resource's behavior. - Server.reference(String urn)
- Creates a typed reference to an existing Server resource.
Properties
-
arn
↔ Output<
String> -
ARN of Transfer Server
latefinal
-
certificate
↔ Output<
String?> -
ARN of the AWS Certificate Manager (ACM) certificate. Required when
protocolsis set toFTPS.latefinal -
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
directoryId
↔ Output<
String?> -
Directory service ID of the directory service you want to connect to with an
identityProviderTypeofAWS_DIRECTORY_SERVICE.latefinal -
domain
↔ Output<
String?> -
Domain of the storage system that is used for file transfers. Valid values are:
S3andEFS. The default value isS3.latefinal -
endpoint
↔ Output<
String> -
Endpoint of the Transfer Server (e.g.,
s-12345678.server.transfer.REGION.amazonaws.com)latefinal -
endpointDetails
↔ Output<
ServerEndpointDetails?> -
VPC endpoint settings that you want to configure for your SFTP server. See
endpointDetailsBlock below for details.latefinal -
endpointType
↔ Output<
String?> -
Type of endpoint that you want your SFTP server connect to. If you connect to a
VPC(orVPC_ENDPOINT), your SFTP server isn't accessible over the public internet. If you want to connect your SFTP server via public internet, setPUBLIC. Defaults toPUBLIC.latefinal -
forceDestroy
↔ Output<
bool?> -
Boolean that indicates all users associated with the server should be deleted so that the Server can be destroyed without error. The default value is
false. This option only applies to servers configured with aSERVICE_MANAGEDidentityProviderType.latefinal -
function
↔ Output<
String?> -
ARN for a lambda function to use for the Identity provider with an
identityProviderTypeofAWS_LAMBDA.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
hostKey
↔ Output<
String?> -
RSA, ECDSA, or ED25519 private key (e.g., as generated by the
ssh-keygen -t rsa -b 2048 -N "" -m PEM -f my-new-server-key,ssh-keygen -t ecdsa -b 256 -N "" -m PEM -f my-new-server-keyorssh-keygen -t ed25519 -N "" -f my-new-server-keycommands).latefinal -
hostKeyFingerprint
↔ Output<
String> -
Message-digest algorithm (MD5) hash of the server's host key. This value is equivalent to the output of the
ssh-keygen -l -E md5 -f my-new-server-keycommand.latefinal -
id
↔ Output<
String> -
getter/setter pairinherited
-
identityProviderType
↔ Output<
String?> -
Mode of authentication enabled for this service. The default value is
SERVICE_MANAGED, which allows you to store and access SFTP user credentials within the service.API_GATEWAYindicates that user authentication requires a call to an API Gateway endpoint URL provided by you to integrate an identity provider of your choice. UsingAWS_DIRECTORY_SERVICEwill allow for authentication against AWS Managed Active Directory or Microsoft Active Directory in your on-premises environment, or in AWS using AD Connectors. Use theAWS_LAMBDAvalue to directly use a Lambda function as your identity provider. If you choose this value, you must specify the ARN for the lambda function in thefunctionargument.latefinal -
invocationRole
↔ Output<
String?> -
ARN of the IAM role used to authenticate the user account with an
identityProviderTypeofAPI_GATEWAY.latefinal -
ipAddressType
↔ Output<
String> -
Type of IP addresses for the AWS Transfer Family endpoint. Valid values are
IPV4andDUALSTACK. The default value isIPV4. WhenipAddressTypeis set toDUALSTACK,addressAllocationIdscannot be specified in theendpointDetailsblock. UpdatingipAddressTypestops the server and then restarts it with the newipAddressTypevalue.latefinal - isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
loggingRole
↔ Output<
String?> -
ARN of an IAM role that allows the service to write your SFTP users’ activity to your Amazon CloudWatch logs for monitoring and auditing purposes.
latefinal
-
postAuthenticationLoginBanner
↔ Output<
String?> -
Specify a string to display when users connect to a server. This string is displayed after the user authenticates. The SFTP protocol does not support post-authentication display banners.
latefinal
-
preAuthenticationLoginBanner
↔ Output<
String?> -
Specify a string to display when users connect to a server. This string is displayed before the user authenticates.
latefinal
-
protocolDetails
↔ Output<
ServerProtocolDetails> -
Protocol settings that are configured for your server. See
protocolDetailsBlock below for details.latefinal -
protocols
↔ Output<
List< String> > -
File transfer protocol or protocols over which your file transfer protocol client can connect to your server's endpoint. This defaults to
SFTP. The available protocols areAS2(file transfer over Applicability Statement 2),SFTP(file transfer over SSH),FTPS(file transfer with TLS encryption), andFTP(unencrypted file transfer).latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
s3StorageOptions
↔ Output<
ServerS3StorageOptions> -
Whether performance for your Amazon S3 directories is optimized. This is disabled by default. See
s3StorageOptionsBlock below for details.latefinal -
securityPolicyName
↔ Output<
String?> -
Name of the security policy that is attached to the server. Default value is:
TransferSecurityPolicy-2018-11. The available values areTransferSecurityPolicy-2018-11,TransferSecurityPolicy-2020-06,TransferSecurityPolicy-2022-03,TransferSecurityPolicy-2023-05,TransferSecurityPolicy-2024-01,TransferSecurityPolicy-2025-03,TransferSecurityPolicy-FIPS-2020-06,TransferSecurityPolicy-FIPS-2023-05,TransferSecurityPolicy-FIPS-2024-01,TransferSecurityPolicy-FIPS-2024-05,TransferSecurityPolicy-FIPS-2025-03,TransferSecurityPolicy-PQ-SSH-Experimental-2023-04,TransferSecurityPolicy-PQ-SSH-FIPS-Experimental-2023-04,TransferSecurityPolicy-Restricted-2018-11,TransferSecurityPolicy-Restricted-2020-06,TransferSecurityPolicy-Restricted-2024-06,TransferSecurityPolicy-SshAuditCompliant-2025-02, andTransferSecurityPolicy-AS2Restricted-2025-07. See Security policies for AWS Transfer Family servers for details.latefinal -
sftpAuthenticationMethods
↔ Output<
String> -
For SFTP-enabled servers with an
identityProviderTypeofAPI_GATEWAYorAWS_LAMBDA. Valid values arePASSWORD,PUBLIC_KEY,PUBLIC_KEY_OR_PASSWORDandPUBLIC_KEY_AND_PASSWORD. Default value is:PUBLIC_KEY_OR_PASSWORD.latefinal -
structuredLogDestinations
↔ Output<
List< String> ?> -
Set of ARNs of destinations that will receive structured logs from the transfer server such as CloudWatch Log Group ARNs. If provided this enables the transfer server to emit structured logs to the specified locations.
latefinal
-
Map of tags to assign to the resource. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
Map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
url
↔ Output<
String?> -
URL of the service endpoint used to authenticate users with an
identityProviderTypeofAPI_GATEWAY.latefinal -
urn
↔ Output<
String> -
latefinalinherited
-
workflowDetails
↔ Output<
ServerWorkflowDetails?> -
Workflow details. See
workflowDetailsBlock below for details.latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited