Skip to content

Server

Source: src/AWS/Transfer/Server.ts

An AWS Transfer Family server — a managed SFTP/FTPS/FTP/AS2 endpoint in front of S3 or EFS storage. A running server is billed hourly (plus data transfer), so create it only when needed and destroy it promptly.

const server = yield* Server("Sftp", {
protocols: ["SFTP"],
domain: "S3",
endpointType: "PUBLIC",
identityProviderType: "SERVICE_MANAGED",
});
const server = yield* Server("Sftp", {
protocols: ["SFTP"],
identityProviderType: "SERVICE_MANAGED",
});
// Role Transfer Family assumes to access the S3 storage backend
const role = yield* AWS.IAM.Role("TransferUserRole", {
assumeRolePolicyDocument: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: { Service: "transfer.amazonaws.com" },
Action: ["sts:AssumeRole"],
},
],
},
inlinePolicies: {
s3: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Action: ["s3:ListBucket", "s3:GetObject", "s3:PutObject"],
Resource: [bucket.bucketArn, Output.interpolate`${bucket.bucketArn}/*`],
},
],
},
},
});
const user = yield* User("Alice", {
serverId: server.serverId,
userName: "alice",
role: role.roleArn,
homeDirectory: Output.interpolate`/${bucket.bucketName}/alice`,
sshPublicKeyBody: "ssh-ed25519 AAAA...",
});