1. Packages
  2. AWS
  3. API Docs
  4. lightsail
  5. Disk
AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi

aws.lightsail.Disk

Explore with Pulumi AI

aws logo
AWS v6.83.0 published on Monday, Jun 16, 2025 by Pulumi

    Manages a Lightsail disk. Use this resource to create additional block storage that can be attached to Lightsail instances for extra storage capacity.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const available = aws.getAvailabilityZones({
        state: "available",
        filters: [{
            name: "opt-in-status",
            values: ["opt-in-not-required"],
        }],
    });
    const example = new aws.lightsail.Disk("example", {
        name: "example-disk",
        sizeInGb: 8,
        availabilityZone: available.then(available => available.names?.[0]),
    });
    
    import pulumi
    import pulumi_aws as aws
    
    available = aws.get_availability_zones(state="available",
        filters=[{
            "name": "opt-in-status",
            "values": ["opt-in-not-required"],
        }])
    example = aws.lightsail.Disk("example",
        name="example-disk",
        size_in_gb=8,
        availability_zone=available.names[0])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		available, err := aws.GetAvailabilityZones(ctx, &aws.GetAvailabilityZonesArgs{
    			State: pulumi.StringRef("available"),
    			Filters: []aws.GetAvailabilityZonesFilter{
    				{
    					Name: "opt-in-status",
    					Values: []string{
    						"opt-in-not-required",
    					},
    				},
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = lightsail.NewDisk(ctx, "example", &lightsail.DiskArgs{
    			Name:             pulumi.String("example-disk"),
    			SizeInGb:         pulumi.Int(8),
    			AvailabilityZone: pulumi.String(available.Names[0]),
    		})
    		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 available = Aws.GetAvailabilityZones.Invoke(new()
        {
            State = "available",
            Filters = new[]
            {
                new Aws.Inputs.GetAvailabilityZonesFilterInputArgs
                {
                    Name = "opt-in-status",
                    Values = new[]
                    {
                        "opt-in-not-required",
                    },
                },
            },
        });
    
        var example = new Aws.LightSail.Disk("example", new()
        {
            Name = "example-disk",
            SizeInGb = 8,
            AvailabilityZone = available.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Names[0]),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.AwsFunctions;
    import com.pulumi.aws.inputs.GetAvailabilityZonesArgs;
    import com.pulumi.aws.lightsail.Disk;
    import com.pulumi.aws.lightsail.DiskArgs;
    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) {
            final var available = AwsFunctions.getAvailabilityZones(GetAvailabilityZonesArgs.builder()
                .state("available")
                .filters(GetAvailabilityZonesFilterArgs.builder()
                    .name("opt-in-status")
                    .values("opt-in-not-required")
                    .build())
                .build());
    
            var example = new Disk("example", DiskArgs.builder()
                .name("example-disk")
                .sizeInGb(8)
                .availabilityZone(available.names()[0])
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:lightsail:Disk
        properties:
          name: example-disk
          sizeInGb: 8
          availabilityZone: ${available.names[0]}
    variables:
      available:
        fn::invoke:
          function: aws:getAvailabilityZones
          arguments:
            state: available
            filters:
              - name: opt-in-status
                values:
                  - opt-in-not-required
    

    Create Disk Resource

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

    Constructor syntax

    new Disk(name: string, args: DiskArgs, opts?: CustomResourceOptions);
    @overload
    def Disk(resource_name: str,
             args: DiskArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def Disk(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             availability_zone: Optional[str] = None,
             size_in_gb: Optional[int] = None,
             name: Optional[str] = None,
             tags: Optional[Mapping[str, str]] = None)
    func NewDisk(ctx *Context, name string, args DiskArgs, opts ...ResourceOption) (*Disk, error)
    public Disk(string name, DiskArgs args, CustomResourceOptions? opts = null)
    public Disk(String name, DiskArgs args)
    public Disk(String name, DiskArgs args, CustomResourceOptions options)
    
    type: aws:lightsail:Disk
    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 DiskArgs
    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 DiskArgs
    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 DiskArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args DiskArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args DiskArgs
    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 diskResource = new Aws.LightSail.Disk("diskResource", new()
    {
        AvailabilityZone = "string",
        SizeInGb = 0,
        Name = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := lightsail.NewDisk(ctx, "diskResource", &lightsail.DiskArgs{
    	AvailabilityZone: pulumi.String("string"),
    	SizeInGb:         pulumi.Int(0),
    	Name:             pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var diskResource = new Disk("diskResource", DiskArgs.builder()
        .availabilityZone("string")
        .sizeInGb(0)
        .name("string")
        .tags(Map.of("string", "string"))
        .build());
    
    disk_resource = aws.lightsail.Disk("diskResource",
        availability_zone="string",
        size_in_gb=0,
        name="string",
        tags={
            "string": "string",
        })
    
    const diskResource = new aws.lightsail.Disk("diskResource", {
        availabilityZone: "string",
        sizeInGb: 0,
        name: "string",
        tags: {
            string: "string",
        },
    });
    
    type: aws:lightsail:Disk
    properties:
        availabilityZone: string
        name: string
        sizeInGb: 0
        tags:
            string: string
    

    Disk 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 Disk resource accepts the following input properties:

    AvailabilityZone string
    Availability Zone in which to create the disk.
    SizeInGb int

    Size of the disk in GB.

    The following arguments are optional:

    Name string
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    Tags Dictionary<string, string>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    AvailabilityZone string
    Availability Zone in which to create the disk.
    SizeInGb int

    Size of the disk in GB.

    The following arguments are optional:

    Name string
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    Tags map[string]string
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    availabilityZone String
    Availability Zone in which to create the disk.
    sizeInGb Integer

    Size of the disk in GB.

    The following arguments are optional:

    name String
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    tags Map<String,String>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    availabilityZone string
    Availability Zone in which to create the disk.
    sizeInGb number

    Size of the disk in GB.

    The following arguments are optional:

    name string
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    tags {[key: string]: string}
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    availability_zone str
    Availability Zone in which to create the disk.
    size_in_gb int

    Size of the disk in GB.

    The following arguments are optional:

    name str
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    tags Mapping[str, str]
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    availabilityZone String
    Availability Zone in which to create the disk.
    sizeInGb Number

    Size of the disk in GB.

    The following arguments are optional:

    name String
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    tags Map<String>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. 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 Disk resource produces the following output properties:

    Arn string
    ARN of the disk.
    CreatedAt string
    Date and time when the disk was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    SupportCode string
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    TagsAll Dictionary<string, string>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    ARN of the disk.
    CreatedAt string
    Date and time when the disk was created.
    Id string
    The provider-assigned unique ID for this managed resource.
    SupportCode string
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    TagsAll map[string]string
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the disk.
    createdAt String
    Date and time when the disk was created.
    id String
    The provider-assigned unique ID for this managed resource.
    supportCode String
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    tagsAll Map<String,String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    ARN of the disk.
    createdAt string
    Date and time when the disk was created.
    id string
    The provider-assigned unique ID for this managed resource.
    supportCode string
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    tagsAll {[key: string]: string}
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    ARN of the disk.
    created_at str
    Date and time when the disk was created.
    id str
    The provider-assigned unique ID for this managed resource.
    support_code str
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    tags_all Mapping[str, str]
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the disk.
    createdAt String
    Date and time when the disk was created.
    id String
    The provider-assigned unique ID for this managed resource.
    supportCode String
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    tagsAll Map<String>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Look up Existing Disk Resource

    Get an existing Disk 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?: DiskState, opts?: CustomResourceOptions): Disk
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            availability_zone: Optional[str] = None,
            created_at: Optional[str] = None,
            name: Optional[str] = None,
            size_in_gb: Optional[int] = None,
            support_code: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            tags_all: Optional[Mapping[str, str]] = None) -> Disk
    func GetDisk(ctx *Context, name string, id IDInput, state *DiskState, opts ...ResourceOption) (*Disk, error)
    public static Disk Get(string name, Input<string> id, DiskState? state, CustomResourceOptions? opts = null)
    public static Disk get(String name, Output<String> id, DiskState state, CustomResourceOptions options)
    resources:  _:    type: aws:lightsail:Disk    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
    ARN of the disk.
    AvailabilityZone string
    Availability Zone in which to create the disk.
    CreatedAt string
    Date and time when the disk was created.
    Name string
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    SizeInGb int

    Size of the disk in GB.

    The following arguments are optional:

    SupportCode string
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    Tags Dictionary<string, string>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. 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>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Arn string
    ARN of the disk.
    AvailabilityZone string
    Availability Zone in which to create the disk.
    CreatedAt string
    Date and time when the disk was created.
    Name string
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    SizeInGb int

    Size of the disk in GB.

    The following arguments are optional:

    SupportCode string
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    Tags map[string]string
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. 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
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the disk.
    availabilityZone String
    Availability Zone in which to create the disk.
    createdAt String
    Date and time when the disk was created.
    name String
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    sizeInGb Integer

    Size of the disk in GB.

    The following arguments are optional:

    supportCode String
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    tags Map<String,String>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. 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>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn string
    ARN of the disk.
    availabilityZone string
    Availability Zone in which to create the disk.
    createdAt string
    Date and time when the disk was created.
    name string
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    sizeInGb number

    Size of the disk in GB.

    The following arguments are optional:

    supportCode string
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    tags {[key: string]: string}
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. 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}
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn str
    ARN of the disk.
    availability_zone str
    Availability Zone in which to create the disk.
    created_at str
    Date and time when the disk was created.
    name str
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    size_in_gb int

    Size of the disk in GB.

    The following arguments are optional:

    support_code str
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    tags Mapping[str, str]
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. 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]
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    arn String
    ARN of the disk.
    availabilityZone String
    Availability Zone in which to create the disk.
    createdAt String
    Date and time when the disk was created.
    name String
    Name of the disk. Must begin with an alphabetic character and contain only alphanumeric characters, underscores, hyphens, and dots.
    sizeInGb Number

    Size of the disk in GB.

    The following arguments are optional:

    supportCode String
    Support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail.
    tags Map<String>
    Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. 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>
    Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

    Deprecated: Please use tags instead.

    Import

    Using pulumi import, import aws_lightsail_disk using the name attribute. For example:

    $ pulumi import aws:lightsail/disk:Disk example example-disk
    

    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 v6.83.0 published on Monday, Jun 16, 2025 by Pulumi