1. Packages
  2. AWS
  3. API Docs
  4. transfer
  5. HostKey
AWS v7.10.0 published on Friday, Oct 24, 2025 by Pulumi

aws.transfer.HostKey

Get Started
aws logo
AWS v7.10.0 published on Friday, Oct 24, 2025 by Pulumi

    Manages a host key for a server. This is an additional server host key.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.transfer.HostKey("example", {
        serverId: exampleAwsTransferServer.id,
        description: "example additional host key",
        hostKeyBodyWo: "# Private key PEM.\n",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.transfer.HostKey("example",
        server_id=example_aws_transfer_server["id"],
        description="example additional host key",
        host_key_body_wo="# Private key PEM.\n")
    
    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.NewHostKey(ctx, "example", &transfer.HostKeyArgs{
    			ServerId:      pulumi.Any(exampleAwsTransferServer.Id),
    			Description:   pulumi.String("example additional host key"),
    			HostKeyBodyWo: pulumi.String("# Private key PEM.\n"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Transfer.HostKey("example", new()
        {
            ServerId = exampleAwsTransferServer.Id,
            Description = "example additional host key",
            HostKeyBodyWo = @"# Private key PEM.
    ",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.transfer.HostKey;
    import com.pulumi.aws.transfer.HostKeyArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 HostKey("example", HostKeyArgs.builder()
                .serverId(exampleAwsTransferServer.id())
                .description("example additional host key")
                .hostKeyBodyWo("""
    # Private key PEM.
                """)
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:transfer:HostKey
        properties:
          serverId: ${exampleAwsTransferServer.id}
          description: example additional host key
          hostKeyBodyWo: |
            # Private key PEM.        
    

    Create HostKey Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new HostKey(name: string, args: HostKeyArgs, opts?: CustomResourceOptions);
    @overload
    def HostKey(resource_name: str,
                args: HostKeyArgs,
                opts: Optional[ResourceOptions] = None)
    
    @overload
    def HostKey(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                server_id: Optional[str] = None,
                description: Optional[str] = None,
                host_key_body: Optional[str] = None,
                host_key_body_wo: Optional[str] = None,
                region: Optional[str] = None,
                tags: Optional[Mapping[str, str]] = None)
    func NewHostKey(ctx *Context, name string, args HostKeyArgs, opts ...ResourceOption) (*HostKey, error)
    public HostKey(string name, HostKeyArgs args, CustomResourceOptions? opts = null)
    public HostKey(String name, HostKeyArgs args)
    public HostKey(String name, HostKeyArgs args, CustomResourceOptions options)
    
    type: aws:transfer:HostKey
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args HostKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args HostKeyArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args HostKeyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args HostKeyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args HostKeyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var hostKeyResource = new Aws.Transfer.HostKey("hostKeyResource", new()
    {
        ServerId = "string",
        Description = "string",
        HostKeyBody = "string",
        HostKeyBodyWo = "string",
        Region = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := transfer.NewHostKey(ctx, "hostKeyResource", &transfer.HostKeyArgs{
    	ServerId:      pulumi.String("string"),
    	Description:   pulumi.String("string"),
    	HostKeyBody:   pulumi.String("string"),
    	HostKeyBodyWo: pulumi.String("string"),
    	Region:        pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var hostKeyResource = new HostKey("hostKeyResource", HostKeyArgs.builder()
        .serverId("string")
        .description("string")
        .hostKeyBody("string")
        .hostKeyBodyWo("string")
        .region("string")
        .tags(Map.of("string", "string"))
        .build());
    
    host_key_resource = aws.transfer.HostKey("hostKeyResource",
        server_id="string",
        description="string",
        host_key_body="string",
        host_key_body_wo="string",
        region="string",
        tags={
            "string": "string",
        })
    
    const hostKeyResource = new aws.transfer.HostKey("hostKeyResource", {
        serverId: "string",
        description: "string",
        hostKeyBody: "string",
        hostKeyBodyWo: "string",
        region: "string",
        tags: {
            string: "string",
        },
    });
    
    type: aws:transfer:HostKey
    properties:
        description: string
        hostKeyBody: string
        hostKeyBodyWo: string
        region: string
        serverId: string
        tags:
            string: string
    

    HostKey Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The HostKey resource accepts the following input properties:

    ServerId string
    Server ID.
    Description string
    Text description.
    HostKeyBody string
    Private key portion of an SSH key pair.
    HostKeyBodyWo string
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    Tags Dictionary<string, string>
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    ServerId string
    Server ID.
    Description string
    Text description.
    HostKeyBody string
    Private key portion of an SSH key pair.
    HostKeyBodyWo string
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    Tags map[string]string
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    serverId String
    Server ID.
    description String
    Text description.
    hostKeyBody String
    Private key portion of an SSH key pair.
    hostKeyBodyWo String
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Map<String,String>
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    serverId string
    Server ID.
    description string
    Text description.
    hostKeyBody string
    Private key portion of an SSH key pair.
    hostKeyBodyWo string
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags {[key: string]: string}
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    server_id str
    Server ID.
    description str
    Text description.
    host_key_body str
    Private key portion of an SSH key pair.
    host_key_body_wo str
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    region str
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Mapping[str, str]
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    serverId String
    Server ID.
    description String
    Text description.
    hostKeyBody String
    Private key portion of an SSH key pair.
    hostKeyBodyWo String
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    tags Map<String>
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the HostKey resource produces the following output properties:

    Arn string
    Amazon Resource Name (ARN) of host key.
    HostKeyFingerprint string
    Public key fingerprint.
    HostKeyId string
    ID of the host key.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    Arn string
    Amazon Resource Name (ARN) of host key.
    HostKeyFingerprint string
    Public key fingerprint.
    HostKeyId string
    ID of the host key.
    Id string
    The provider-assigned unique ID for this managed resource.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    arn String
    Amazon Resource Name (ARN) of host key.
    hostKeyFingerprint String
    Public key fingerprint.
    hostKeyId String
    ID of the host key.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    arn string
    Amazon Resource Name (ARN) of host key.
    hostKeyFingerprint string
    Public key fingerprint.
    hostKeyId string
    ID of the host key.
    id string
    The provider-assigned unique ID for this managed resource.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    arn str
    Amazon Resource Name (ARN) of host key.
    host_key_fingerprint str
    Public key fingerprint.
    host_key_id str
    ID of the host key.
    id str
    The provider-assigned unique ID for this managed resource.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    arn String
    Amazon Resource Name (ARN) of host key.
    hostKeyFingerprint String
    Public key fingerprint.
    hostKeyId String
    ID of the host key.
    id String
    The provider-assigned unique ID for this managed resource.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Look up Existing HostKey Resource

    Get an existing HostKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: HostKeyState, opts?: CustomResourceOptions): HostKey
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            description: Optional[str] = None,
            host_key_body: Optional[str] = None,
            host_key_body_wo: Optional[str] = None,
            host_key_fingerprint: Optional[str] = None,
            host_key_id: Optional[str] = None,
            region: Optional[str] = None,
            server_id: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None) -> HostKey
    func GetHostKey(ctx *Context, name string, id IDInput, state *HostKeyState, opts ...ResourceOption) (*HostKey, error)
    public static HostKey Get(string name, Input<string> id, HostKeyState? state, CustomResourceOptions? opts = null)
    public static HostKey get(String name, Output<String> id, HostKeyState state, CustomResourceOptions options)
    resources:  _:    type: aws:transfer:HostKey    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Arn string
    Amazon Resource Name (ARN) of host key.
    Description string
    Text description.
    HostKeyBody string
    Private key portion of an SSH key pair.
    HostKeyBodyWo string
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    HostKeyFingerprint string
    Public key fingerprint.
    HostKeyId string
    ID of the host key.
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    ServerId string
    Server ID.
    Tags Dictionary<string, string>
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll Dictionary<string, string>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    Arn string
    Amazon Resource Name (ARN) of host key.
    Description string
    Text description.
    HostKeyBody string
    Private key portion of an SSH key pair.
    HostKeyBodyWo string
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    HostKeyFingerprint string
    Public key fingerprint.
    HostKeyId string
    ID of the host key.
    Region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    ServerId string
    Server ID.
    Tags map[string]string
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    TagsAll map[string]string
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    arn String
    Amazon Resource Name (ARN) of host key.
    description String
    Text description.
    hostKeyBody String
    Private key portion of an SSH key pair.
    hostKeyBodyWo String
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    hostKeyFingerprint String
    Public key fingerprint.
    hostKeyId String
    ID of the host key.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    serverId String
    Server ID.
    tags Map<String,String>
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String,String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    arn string
    Amazon Resource Name (ARN) of host key.
    description string
    Text description.
    hostKeyBody string
    Private key portion of an SSH key pair.
    hostKeyBodyWo string
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    hostKeyFingerprint string
    Public key fingerprint.
    hostKeyId string
    ID of the host key.
    region string
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    serverId string
    Server ID.
    tags {[key: string]: string}
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll {[key: string]: string}
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    arn str
    Amazon Resource Name (ARN) of host key.
    description str
    Text description.
    host_key_body str
    Private key portion of an SSH key pair.
    host_key_body_wo str
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    host_key_fingerprint str
    Public key fingerprint.
    host_key_id str
    ID of the host key.
    region str
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    server_id str
    Server ID.
    tags Mapping[str, str]
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tags_all Mapping[str, str]
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.
    arn String
    Amazon Resource Name (ARN) of host key.
    description String
    Text description.
    hostKeyBody String
    Private key portion of an SSH key pair.
    hostKeyBodyWo String
    NOTE: This field is write-only and its value will not be updated in state as part of read operations. Write-only private key portion of an SSH key pair, guaranteed not to be written to plan or state artifacts. One of host_key_body or host_key_body_wo must be configured.
    hostKeyFingerprint String
    Public key fingerprint.
    hostKeyId String
    ID of the host key.
    region String
    Region where this resource will be managed. Defaults to the Region set in the provider configuration.
    serverId String
    Server ID.
    tags Map<String>
    A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    tagsAll Map<String>
    A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Import

    Using pulumi import, import host keys using the server_id and host_key_id separated by ,. For example:

    $ pulumi import aws:transfer/hostKey:HostKey example s-12345678,key-12345
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v7.10.0 published on Friday, Oct 24, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate