1. Packages
  2. AWS
  3. API Docs
  4. lightsail
  5. Disk
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.lightsail.Disk

Explore with Pulumi AI

Provides a Lightsail Disk resource.

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 test = new aws.lightsail.Disk("test", {
    name: "test",
    sizeInGb: 8,
    availabilityZone: available.then(available => available.names?.[0]),
});
Copy
import pulumi
import pulumi_aws as aws

available = aws.get_availability_zones(state="available",
    filters=[{
        "name": "opt-in-status",
        "values": ["opt-in-not-required"],
    }])
test = aws.lightsail.Disk("test",
    name="test",
    size_in_gb=8,
    availability_zone=available.names[0])
Copy
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, "test", &lightsail.DiskArgs{
			Name:             pulumi.String("test"),
			SizeInGb:         pulumi.Int(8),
			AvailabilityZone: pulumi.String(available.Names[0]),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 test = new Aws.LightSail.Disk("test", new()
    {
        Name = "test",
        SizeInGb = 8,
        AvailabilityZone = available.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Names[0]),
    });

});
Copy
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 test = new Disk("test", DiskArgs.builder()
            .name("test")
            .sizeInGb(8)
            .availabilityZone(available.applyValue(getAvailabilityZonesResult -> getAvailabilityZonesResult.names()[0]))
            .build());

    }
}
Copy
resources:
  test:
    type: aws:lightsail:Disk
    properties:
      name: test
      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
Copy

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 This property is required. string
The unique name of the resource.
args This property is required. DiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. DiskArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. DiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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" },
    },
});
Copy
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"),
	},
})
Copy
var diskResource = new Disk("diskResource", DiskArgs.builder()
    .availabilityZone("string")
    .sizeInGb(0)
    .name("string")
    .tags(Map.of("string", "string"))
    .build());
Copy
disk_resource = aws.lightsail.Disk("diskResource",
    availability_zone="string",
    size_in_gb=0,
    name="string",
    tags={
        "string": "string",
    })
Copy
const diskResource = new aws.lightsail.Disk("diskResource", {
    availabilityZone: "string",
    sizeInGb: 0,
    name: "string",
    tags: {
        string: "string",
    },
});
Copy
type: aws:lightsail:Disk
properties:
    availabilityZone: string
    name: string
    sizeInGb: 0
    tags:
        string: string
Copy

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
This property is required.
Changes to this property will trigger replacement.
string
The Availability Zone in which to create your disk.
SizeInGb
This property is required.
Changes to this property will trigger replacement.
int
The size of the disk in GB.
Name Changes to this property will trigger replacement. string
The name of the disk.
Tags Dictionary<string, string>
A 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
This property is required.
Changes to this property will trigger replacement.
string
The Availability Zone in which to create your disk.
SizeInGb
This property is required.
Changes to this property will trigger replacement.
int
The size of the disk in GB.
Name Changes to this property will trigger replacement. string
The name of the disk.
Tags map[string]string
A 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
This property is required.
Changes to this property will trigger replacement.
String
The Availability Zone in which to create your disk.
sizeInGb
This property is required.
Changes to this property will trigger replacement.
Integer
The size of the disk in GB.
name Changes to this property will trigger replacement. String
The name of the disk.
tags Map<String,String>
A 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
This property is required.
Changes to this property will trigger replacement.
string
The Availability Zone in which to create your disk.
sizeInGb
This property is required.
Changes to this property will trigger replacement.
number
The size of the disk in GB.
name Changes to this property will trigger replacement. string
The name of the disk.
tags {[key: string]: string}
A 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
This property is required.
Changes to this property will trigger replacement.
str
The Availability Zone in which to create your disk.
size_in_gb
This property is required.
Changes to this property will trigger replacement.
int
The size of the disk in GB.
name Changes to this property will trigger replacement. str
The name of the disk.
tags Mapping[str, str]
A 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
This property is required.
Changes to this property will trigger replacement.
String
The Availability Zone in which to create your disk.
sizeInGb
This property is required.
Changes to this property will trigger replacement.
Number
The size of the disk in GB.
name Changes to this property will trigger replacement. String
The name of the disk.
tags Map<String>
A 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
The ARN of the Lightsail disk.
CreatedAt string
The timestamp when the disk was created.
Id string
The provider-assigned unique ID for this managed resource.
SupportCode string
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
TagsAll Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
The ARN of the Lightsail disk.
CreatedAt string
The timestamp when the disk was created.
Id string
The provider-assigned unique ID for this managed resource.
SupportCode string
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
TagsAll map[string]string
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the Lightsail disk.
createdAt String
The timestamp when the disk was created.
id String
The provider-assigned unique ID for this managed resource.
supportCode String
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tagsAll Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
The ARN of the Lightsail disk.
createdAt string
The timestamp when the disk was created.
id string
The provider-assigned unique ID for this managed resource.
supportCode string
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tagsAll {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
The ARN of the Lightsail disk.
created_at str
The timestamp when the disk was created.
id str
The provider-assigned unique ID for this managed resource.
support_code str
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tags_all Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the Lightsail disk.
createdAt String
The timestamp when the disk was created.
id String
The provider-assigned unique ID for this managed resource.
supportCode String
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tagsAll Map<String>
A 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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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
The ARN of the Lightsail disk.
AvailabilityZone Changes to this property will trigger replacement. string
The Availability Zone in which to create your disk.
CreatedAt string
The timestamp when the disk was created.
Name Changes to this property will trigger replacement. string
The name of the disk.
SizeInGb Changes to this property will trigger replacement. int
The size of the disk in GB.
SupportCode string
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
Tags Dictionary<string, string>
A 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>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

Arn string
The ARN of the Lightsail disk.
AvailabilityZone Changes to this property will trigger replacement. string
The Availability Zone in which to create your disk.
CreatedAt string
The timestamp when the disk was created.
Name Changes to this property will trigger replacement. string
The name of the disk.
SizeInGb Changes to this property will trigger replacement. int
The size of the disk in GB.
SupportCode string
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
Tags map[string]string
A 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
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the Lightsail disk.
availabilityZone Changes to this property will trigger replacement. String
The Availability Zone in which to create your disk.
createdAt String
The timestamp when the disk was created.
name Changes to this property will trigger replacement. String
The name of the disk.
sizeInGb Changes to this property will trigger replacement. Integer
The size of the disk in GB.
supportCode String
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tags Map<String,String>
A 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>
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn string
The ARN of the Lightsail disk.
availabilityZone Changes to this property will trigger replacement. string
The Availability Zone in which to create your disk.
createdAt string
The timestamp when the disk was created.
name Changes to this property will trigger replacement. string
The name of the disk.
sizeInGb Changes to this property will trigger replacement. number
The size of the disk in GB.
supportCode string
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tags {[key: string]: string}
A 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}
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn str
The ARN of the Lightsail disk.
availability_zone Changes to this property will trigger replacement. str
The Availability Zone in which to create your disk.
created_at str
The timestamp when the disk was created.
name Changes to this property will trigger replacement. str
The name of the disk.
size_in_gb Changes to this property will trigger replacement. int
The size of the disk in GB.
support_code str
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tags Mapping[str, str]
A 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]
A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Deprecated: Please use tags instead.

arn String
The ARN of the Lightsail disk.
availabilityZone Changes to this property will trigger replacement. String
The Availability Zone in which to create your disk.
createdAt String
The timestamp when the disk was created.
name Changes to this property will trigger replacement. String
The name of the disk.
sizeInGb Changes to this property will trigger replacement. Number
The size of the disk in GB.
supportCode String
The support code for the disk. Include this code in your email to support when you have questions about a disk in Lightsail. This code enables our support team to look up your Lightsail information more easily.
tags Map<String>
A 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>
A 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 test test
Copy

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.