GetSnapshot

Use this data source to get information about an EBS Snapshot for use when provisioning EBS Volumes

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var ebsVolume = Output.Create(Aws.Ebs.GetSnapshot.InvokeAsync(new Aws.Ebs.GetSnapshotArgs
        {
            Filters = 
            {
                new Aws.Ebs.Inputs.GetSnapshotFilterArgs
                {
                    Name = "volume-size",
                    Values = 
                    {
                        "40",
                    },
                },
                new Aws.Ebs.Inputs.GetSnapshotFilterArgs
                {
                    Name = "tag:Name",
                    Values = 
                    {
                        "Example",
                    },
                },
            },
            MostRecent = true,
            Owners = 
            {
                "self",
            },
        }));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ebs"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := true
        _, err := ebs.LookupSnapshot(ctx, &ebs.LookupSnapshotArgs{
            Filters: []ebs.GetSnapshotFilter{
                ebs.GetSnapshotFilter{
                    Name: "volume-size",
                    Values: []string{
                        "40",
                    },
                },
                ebs.GetSnapshotFilter{
                    Name: "tag:Name",
                    Values: []string{
                        "Example",
                    },
                },
            },
            MostRecent: &opt0,
            Owners: []string{
                "self",
            },
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

ebs_volume = aws.ebs.get_snapshot(filters=[
        {
            "name": "volume-size",
            "values": ["40"],
        },
        {
            "name": "tag:Name",
            "values": ["Example"],
        },
    ],
    most_recent=True,
    owners=["self"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const ebsVolume = pulumi.output(aws.ebs.getSnapshot({
    filters: [
        {
            name: "volume-size",
            values: ["40"],
        },
        {
            name: "tag:Name",
            values: ["Example"],
        },
    ],
    mostRecent: true,
    owners: ["self"],
}, { async: true }));

Using GetSnapshot

function getSnapshot(args: GetSnapshotArgs, opts?: InvokeOptions): Promise<GetSnapshotResult>
function  get_snapshot(filters=None, most_recent=None, owners=None, restorable_by_user_ids=None, snapshot_ids=None, tags=None, opts=None)
func LookupSnapshot(ctx *Context, args *LookupSnapshotArgs, opts ...InvokeOption) (*LookupSnapshotResult, error)

Note: This function is named LookupSnapshot in the Go SDK.

public static class GetSnapshot {
    public static Task<GetSnapshotResult> InvokeAsync(GetSnapshotArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Filters List<GetSnapshotFilterArgs>

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-snapshots in the AWS CLI reference][1].

MostRecent bool

If more than one result is returned, use the most recent snapshot.

Owners List<string>

Returns the snapshots owned by the specified owner id. Multiple owners can be specified.

RestorableByUserIds List<string>

One or more AWS accounts IDs that can create volumes from the snapshot.

SnapshotIds List<string>

Returns information on a specific snapshot_id.

Tags Dictionary<string, string>

A map of tags for the resource.

Filters []GetSnapshotFilter

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-snapshots in the AWS CLI reference][1].

MostRecent bool

If more than one result is returned, use the most recent snapshot.

Owners []string

Returns the snapshots owned by the specified owner id. Multiple owners can be specified.

RestorableByUserIds []string

One or more AWS accounts IDs that can create volumes from the snapshot.

SnapshotIds []string

Returns information on a specific snapshot_id.

Tags map[string]string

A map of tags for the resource.

filters GetSnapshotFilter[]

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-snapshots in the AWS CLI reference][1].

mostRecent boolean

If more than one result is returned, use the most recent snapshot.

owners string[]

Returns the snapshots owned by the specified owner id. Multiple owners can be specified.

restorableByUserIds string[]

One or more AWS accounts IDs that can create volumes from the snapshot.

snapshotIds string[]

Returns information on a specific snapshot_id.

tags {[key: string]: string}

A map of tags for the resource.

filters List[GetSnapshotFilter]

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out [describe-snapshots in the AWS CLI reference][1].

most_recent bool

If more than one result is returned, use the most recent snapshot.

owners List[str]

Returns the snapshots owned by the specified owner id. Multiple owners can be specified.

restorable_by_user_ids List[str]

One or more AWS accounts IDs that can create volumes from the snapshot.

snapshot_ids List[str]

Returns information on a specific snapshot_id.

tags Dict[str, str]

A map of tags for the resource.

GetSnapshot Result

The following output properties are available:

Arn string

Amazon Resource Name (ARN) of the EBS Snapshot.

DataEncryptionKeyId string

The data encryption key identifier for the snapshot.

Description string

A description for the snapshot

Encrypted bool

Whether the snapshot is encrypted.

Id string

The provider-assigned unique ID for this managed resource.

KmsKeyId string

The ARN for the KMS encryption key.

OwnerAlias string

Value from an Amazon-maintained list (amazon, aws-marketplace, microsoft) of snapshot owners.

OwnerId string

The AWS account ID of the EBS snapshot owner.

SnapshotId string

The snapshot ID (e.g. snap-59fcb34e).

State string

The snapshot state.

Tags Dictionary<string, string>

A map of tags for the resource.

VolumeId string

The volume ID (e.g. vol-59fcb34e).

VolumeSize int

The size of the drive in GiBs.

Filters List<GetSnapshotFilter>
MostRecent bool
Owners List<string>
RestorableByUserIds List<string>
SnapshotIds List<string>
Arn string

Amazon Resource Name (ARN) of the EBS Snapshot.

DataEncryptionKeyId string

The data encryption key identifier for the snapshot.

Description string

A description for the snapshot

Encrypted bool

Whether the snapshot is encrypted.

Id string

The provider-assigned unique ID for this managed resource.

KmsKeyId string

The ARN for the KMS encryption key.

OwnerAlias string

Value from an Amazon-maintained list (amazon, aws-marketplace, microsoft) of snapshot owners.

OwnerId string

The AWS account ID of the EBS snapshot owner.

SnapshotId string

The snapshot ID (e.g. snap-59fcb34e).

State string

The snapshot state.

Tags map[string]string

A map of tags for the resource.

VolumeId string

The volume ID (e.g. vol-59fcb34e).

VolumeSize int

The size of the drive in GiBs.

Filters []GetSnapshotFilter
MostRecent bool
Owners []string
RestorableByUserIds []string
SnapshotIds []string
arn string

Amazon Resource Name (ARN) of the EBS Snapshot.

dataEncryptionKeyId string

The data encryption key identifier for the snapshot.

description string

A description for the snapshot

encrypted boolean

Whether the snapshot is encrypted.

id string

The provider-assigned unique ID for this managed resource.

kmsKeyId string

The ARN for the KMS encryption key.

ownerAlias string

Value from an Amazon-maintained list (amazon, aws-marketplace, microsoft) of snapshot owners.

ownerId string

The AWS account ID of the EBS snapshot owner.

snapshotId string

The snapshot ID (e.g. snap-59fcb34e).

state string

The snapshot state.

tags {[key: string]: string}

A map of tags for the resource.

volumeId string

The volume ID (e.g. vol-59fcb34e).

volumeSize number

The size of the drive in GiBs.

filters GetSnapshotFilter[]
mostRecent boolean
owners string[]
restorableByUserIds string[]
snapshotIds string[]
arn str

Amazon Resource Name (ARN) of the EBS Snapshot.

data_encryption_key_id str

The data encryption key identifier for the snapshot.

description str

A description for the snapshot

encrypted bool

Whether the snapshot is encrypted.

id str

The provider-assigned unique ID for this managed resource.

kms_key_id str

The ARN for the KMS encryption key.

owner_alias str

Value from an Amazon-maintained list (amazon, aws-marketplace, microsoft) of snapshot owners.

owner_id str

The AWS account ID of the EBS snapshot owner.

snapshot_id str

The snapshot ID (e.g. snap-59fcb34e).

state str

The snapshot state.

tags Dict[str, str]

A map of tags for the resource.

volume_id str

The volume ID (e.g. vol-59fcb34e).

volume_size float

The size of the drive in GiBs.

filters List[GetSnapshotFilter]
most_recent bool
owners List[str]
restorable_by_user_ids List[str]
snapshot_ids List[str]

Supporting Types

GetSnapshotFilter

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string
Values List<string>
Name string
Values []string
name string
values string[]
name str
values List[str]

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.