1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. InstanceMetadataDefaults

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.ec2.InstanceMetadataDefaults

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Manages regional EC2 instance metadata default settings. More information can be found in the Configure instance metadata options for new instances user guide.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const enforce_imdsv2 = new aws.ec2.InstanceMetadataDefaults("enforce-imdsv2", {
        httpTokens: "required",
        httpPutResponseHopLimit: 1,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    enforce_imdsv2 = aws.ec2.InstanceMetadataDefaults("enforce-imdsv2",
        http_tokens="required",
        http_put_response_hop_limit=1)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec2.NewInstanceMetadataDefaults(ctx, "enforce-imdsv2", &ec2.InstanceMetadataDefaultsArgs{
    			HttpTokens:              pulumi.String("required"),
    			HttpPutResponseHopLimit: pulumi.Int(1),
    		})
    		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 enforce_imdsv2 = new Aws.Ec2.InstanceMetadataDefaults("enforce-imdsv2", new()
        {
            HttpTokens = "required",
            HttpPutResponseHopLimit = 1,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.InstanceMetadataDefaults;
    import com.pulumi.aws.ec2.InstanceMetadataDefaultsArgs;
    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 enforce_imdsv2 = new InstanceMetadataDefaults("enforce-imdsv2", InstanceMetadataDefaultsArgs.builder()
                .httpTokens("required")
                .httpPutResponseHopLimit(1)
                .build());
    
        }
    }
    
    resources:
      enforce-imdsv2:
        type: aws:ec2:InstanceMetadataDefaults
        properties:
          httpTokens: required
          httpPutResponseHopLimit: 1
    

    Create InstanceMetadataDefaults Resource

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

    Constructor syntax

    new InstanceMetadataDefaults(name: string, args?: InstanceMetadataDefaultsArgs, opts?: CustomResourceOptions);
    @overload
    def InstanceMetadataDefaults(resource_name: str,
                                 args: Optional[InstanceMetadataDefaultsArgs] = None,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def InstanceMetadataDefaults(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 http_endpoint: Optional[str] = None,
                                 http_put_response_hop_limit: Optional[int] = None,
                                 http_tokens: Optional[str] = None,
                                 instance_metadata_tags: Optional[str] = None)
    func NewInstanceMetadataDefaults(ctx *Context, name string, args *InstanceMetadataDefaultsArgs, opts ...ResourceOption) (*InstanceMetadataDefaults, error)
    public InstanceMetadataDefaults(string name, InstanceMetadataDefaultsArgs? args = null, CustomResourceOptions? opts = null)
    public InstanceMetadataDefaults(String name, InstanceMetadataDefaultsArgs args)
    public InstanceMetadataDefaults(String name, InstanceMetadataDefaultsArgs args, CustomResourceOptions options)
    
    type: aws:ec2:InstanceMetadataDefaults
    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 InstanceMetadataDefaultsArgs
    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 InstanceMetadataDefaultsArgs
    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 InstanceMetadataDefaultsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args InstanceMetadataDefaultsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args InstanceMetadataDefaultsArgs
    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 instanceMetadataDefaultsResource = new Aws.Ec2.InstanceMetadataDefaults("instanceMetadataDefaultsResource", new()
    {
        HttpEndpoint = "string",
        HttpPutResponseHopLimit = 0,
        HttpTokens = "string",
        InstanceMetadataTags = "string",
    });
    
    example, err := ec2.NewInstanceMetadataDefaults(ctx, "instanceMetadataDefaultsResource", &ec2.InstanceMetadataDefaultsArgs{
    	HttpEndpoint:            pulumi.String("string"),
    	HttpPutResponseHopLimit: pulumi.Int(0),
    	HttpTokens:              pulumi.String("string"),
    	InstanceMetadataTags:    pulumi.String("string"),
    })
    
    var instanceMetadataDefaultsResource = new InstanceMetadataDefaults("instanceMetadataDefaultsResource", InstanceMetadataDefaultsArgs.builder()
        .httpEndpoint("string")
        .httpPutResponseHopLimit(0)
        .httpTokens("string")
        .instanceMetadataTags("string")
        .build());
    
    instance_metadata_defaults_resource = aws.ec2.InstanceMetadataDefaults("instanceMetadataDefaultsResource",
        http_endpoint="string",
        http_put_response_hop_limit=0,
        http_tokens="string",
        instance_metadata_tags="string")
    
    const instanceMetadataDefaultsResource = new aws.ec2.InstanceMetadataDefaults("instanceMetadataDefaultsResource", {
        httpEndpoint: "string",
        httpPutResponseHopLimit: 0,
        httpTokens: "string",
        instanceMetadataTags: "string",
    });
    
    type: aws:ec2:InstanceMetadataDefaults
    properties:
        httpEndpoint: string
        httpPutResponseHopLimit: 0
        httpTokens: string
        instanceMetadataTags: string
    

    InstanceMetadataDefaults Resource Properties

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

    Inputs

    The InstanceMetadataDefaults resource accepts the following input properties:

    HttpEndpoint string
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    HttpPutResponseHopLimit int
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    HttpTokens string
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    InstanceMetadataTags string
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    HttpEndpoint string
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    HttpPutResponseHopLimit int
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    HttpTokens string
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    InstanceMetadataTags string
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpEndpoint String
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpPutResponseHopLimit Integer
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    httpTokens String
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    instanceMetadataTags String
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpEndpoint string
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpPutResponseHopLimit number
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    httpTokens string
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    instanceMetadataTags string
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    http_endpoint str
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    http_put_response_hop_limit int
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    http_tokens str
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    instance_metadata_tags str
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpEndpoint String
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpPutResponseHopLimit Number
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    httpTokens String
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    instanceMetadataTags String
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing InstanceMetadataDefaults Resource

    Get an existing InstanceMetadataDefaults 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?: InstanceMetadataDefaultsState, opts?: CustomResourceOptions): InstanceMetadataDefaults
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            http_endpoint: Optional[str] = None,
            http_put_response_hop_limit: Optional[int] = None,
            http_tokens: Optional[str] = None,
            instance_metadata_tags: Optional[str] = None) -> InstanceMetadataDefaults
    func GetInstanceMetadataDefaults(ctx *Context, name string, id IDInput, state *InstanceMetadataDefaultsState, opts ...ResourceOption) (*InstanceMetadataDefaults, error)
    public static InstanceMetadataDefaults Get(string name, Input<string> id, InstanceMetadataDefaultsState? state, CustomResourceOptions? opts = null)
    public static InstanceMetadataDefaults get(String name, Output<String> id, InstanceMetadataDefaultsState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    HttpEndpoint string
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    HttpPutResponseHopLimit int
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    HttpTokens string
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    InstanceMetadataTags string
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    HttpEndpoint string
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    HttpPutResponseHopLimit int
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    HttpTokens string
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    InstanceMetadataTags string
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpEndpoint String
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpPutResponseHopLimit Integer
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    httpTokens String
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    instanceMetadataTags String
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpEndpoint string
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpPutResponseHopLimit number
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    httpTokens string
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    instanceMetadataTags string
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    http_endpoint str
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    http_put_response_hop_limit int
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    http_tokens str
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    instance_metadata_tags str
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpEndpoint String
    Whether the metadata service is available. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".
    httpPutResponseHopLimit Number
    The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from 1 to 64, or -1 to indicate no preference. Default: -1.
    httpTokens String
    Whether the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2 (IMDSv2). Can be "optional", "required", or "no-preference". Default: "no-preference".
    instanceMetadataTags String
    Enables or disables access to instance tags from the instance metadata service. Can be "enabled", "disabled", or "no-preference". Default: "no-preference".

    Import

    You cannot import this resource.

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi