AWS v6.73.0 published on Wednesday, Mar 19, 2025 by Pulumi
aws.ebs.getSnapshot
Explore with Pulumi AI
Use this data source to get information about an EBS Snapshot for use when provisioning EBS Volumes
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ebsVolume = aws.ebs.getSnapshot({
    mostRecent: true,
    owners: ["self"],
    filters: [
        {
            name: "volume-size",
            values: ["40"],
        },
        {
            name: "tag:Name",
            values: ["Example"],
        },
    ],
});
import pulumi
import pulumi_aws as aws
ebs_volume = aws.ebs.get_snapshot(most_recent=True,
    owners=["self"],
    filters=[
        {
            "name": "volume-size",
            "values": ["40"],
        },
        {
            "name": "tag:Name",
            "values": ["Example"],
        },
    ])
package main
import (
	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ebs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ebs.LookupSnapshot(ctx, &ebs.LookupSnapshotArgs{
			MostRecent: pulumi.BoolRef(true),
			Owners: []string{
				"self",
			},
			Filters: []ebs.GetSnapshotFilter{
				{
					Name: "volume-size",
					Values: []string{
						"40",
					},
				},
				{
					Name: "tag:Name",
					Values: []string{
						"Example",
					},
				},
			},
		}, nil)
		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 ebsVolume = Aws.Ebs.GetSnapshot.Invoke(new()
    {
        MostRecent = true,
        Owners = new[]
        {
            "self",
        },
        Filters = new[]
        {
            new Aws.Ebs.Inputs.GetSnapshotFilterInputArgs
            {
                Name = "volume-size",
                Values = new[]
                {
                    "40",
                },
            },
            new Aws.Ebs.Inputs.GetSnapshotFilterInputArgs
            {
                Name = "tag:Name",
                Values = new[]
                {
                    "Example",
                },
            },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ebs.EbsFunctions;
import com.pulumi.aws.ebs.inputs.GetSnapshotArgs;
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 ebsVolume = EbsFunctions.getSnapshot(GetSnapshotArgs.builder()
            .mostRecent(true)
            .owners("self")
            .filters(            
                GetSnapshotFilterArgs.builder()
                    .name("volume-size")
                    .values("40")
                    .build(),
                GetSnapshotFilterArgs.builder()
                    .name("tag:Name")
                    .values("Example")
                    .build())
            .build());
    }
}
variables:
  ebsVolume:
    fn::invoke:
      function: aws:ebs:getSnapshot
      arguments:
        mostRecent: true
        owners:
          - self
        filters:
          - name: volume-size
            values:
              - '40'
          - name: tag:Name
            values:
              - Example
Using getSnapshot
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getSnapshot(args: GetSnapshotArgs, opts?: InvokeOptions): Promise<GetSnapshotResult>
function getSnapshotOutput(args: GetSnapshotOutputArgs, opts?: InvokeOptions): Output<GetSnapshotResult>def get_snapshot(filters: Optional[Sequence[GetSnapshotFilter]] = None,
                 most_recent: Optional[bool] = None,
                 owners: Optional[Sequence[str]] = None,
                 restorable_by_user_ids: Optional[Sequence[str]] = None,
                 snapshot_ids: Optional[Sequence[str]] = None,
                 tags: Optional[Mapping[str, str]] = None,
                 opts: Optional[InvokeOptions] = None) -> GetSnapshotResult
def get_snapshot_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetSnapshotFilterArgs]]]] = None,
                 most_recent: Optional[pulumi.Input[bool]] = None,
                 owners: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 restorable_by_user_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 snapshot_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetSnapshotResult]func LookupSnapshot(ctx *Context, args *LookupSnapshotArgs, opts ...InvokeOption) (*LookupSnapshotResult, error)
func LookupSnapshotOutput(ctx *Context, args *LookupSnapshotOutputArgs, opts ...InvokeOption) LookupSnapshotResultOutput> Note: This function is named LookupSnapshot in the Go SDK.
public static class GetSnapshot 
{
    public static Task<GetSnapshotResult> InvokeAsync(GetSnapshotArgs args, InvokeOptions? opts = null)
    public static Output<GetSnapshotResult> Invoke(GetSnapshotInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetSnapshotResult> getSnapshot(GetSnapshotArgs args, InvokeOptions options)
public static Output<GetSnapshotResult> getSnapshot(GetSnapshotArgs args, InvokeOptions options)
fn::invoke:
  function: aws:ebs/getSnapshot:getSnapshot
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Filters
List<GetSnapshot Filter> 
- 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.
- RestorableBy List<string>User Ids 
- One or more AWS accounts IDs that can create volumes from the snapshot.
- SnapshotIds List<string>
- Returns information on a specific snapshot_id.
- Dictionary<string, string>
- Map of tags for the resource.
- Filters
[]GetSnapshot Filter 
- 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.
- RestorableBy []stringUser Ids 
- One or more AWS accounts IDs that can create volumes from the snapshot.
- SnapshotIds []string
- Returns information on a specific snapshot_id.
- map[string]string
- Map of tags for the resource.
- filters
List<GetSnapshot Filter> 
- 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 List<String>
- Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
- restorableBy List<String>User Ids 
- One or more AWS accounts IDs that can create volumes from the snapshot.
- snapshotIds List<String>
- Returns information on a specific snapshot_id.
- Map<String,String>
- Map of tags for the resource.
- filters
GetSnapshot Filter[] 
- 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.
- restorableBy string[]User Ids 
- One or more AWS accounts IDs that can create volumes from the snapshot.
- snapshotIds string[]
- Returns information on a specific snapshot_id.
- {[key: string]: string}
- Map of tags for the resource.
- filters
Sequence[GetSnapshot Filter] 
- 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 Sequence[str]
- Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
- restorable_by_ Sequence[str]user_ ids 
- One or more AWS accounts IDs that can create volumes from the snapshot.
- snapshot_ids Sequence[str]
- Returns information on a specific snapshot_id.
- Mapping[str, str]
- Map of tags for the resource.
- filters List<Property Map>
- 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 List<String>
- Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
- restorableBy List<String>User Ids 
- One or more AWS accounts IDs that can create volumes from the snapshot.
- snapshotIds List<String>
- Returns information on a specific snapshot_id.
- Map<String>
- Map of tags for the resource.
getSnapshot Result
The following output properties are available:
- Arn string
- ARN of the EBS Snapshot.
- DataEncryption stringKey Id 
- The data encryption key identifier for the snapshot.
- Description string
- Description for the snapshot
- Encrypted bool
- Whether the snapshot is encrypted.
- Id string
- The provider-assigned unique ID for this managed resource.
- KmsKey stringId 
- ARN for the KMS encryption key.
- OutpostArn string
- ARN of the Outpost on which the snapshot is stored.
- OwnerAlias string
- Value from an Amazon-maintained list (amazon,aws-marketplace,microsoft) of snapshot owners.
- OwnerId string
- AWS account ID of the EBS snapshot owner.
- SnapshotId string
- Snapshot ID (e.g., snap-59fcb34e).
- StartTime string
- Time stamp when the snapshot was initiated.
- State string
- Snapshot state.
- StorageTier string
- Storage tier in which the snapshot is stored.
- Dictionary<string, string>
- Map of tags for the resource.
- VolumeId string
- Volume ID (e.g., vol-59fcb34e).
- VolumeSize int
- Size of the drive in GiBs.
- Filters
List<GetSnapshot Filter> 
- MostRecent bool
- Owners List<string>
- RestorableBy List<string>User Ids 
- SnapshotIds List<string>
- Arn string
- ARN of the EBS Snapshot.
- DataEncryption stringKey Id 
- The data encryption key identifier for the snapshot.
- Description string
- Description for the snapshot
- Encrypted bool
- Whether the snapshot is encrypted.
- Id string
- The provider-assigned unique ID for this managed resource.
- KmsKey stringId 
- ARN for the KMS encryption key.
- OutpostArn string
- ARN of the Outpost on which the snapshot is stored.
- OwnerAlias string
- Value from an Amazon-maintained list (amazon,aws-marketplace,microsoft) of snapshot owners.
- OwnerId string
- AWS account ID of the EBS snapshot owner.
- SnapshotId string
- Snapshot ID (e.g., snap-59fcb34e).
- StartTime string
- Time stamp when the snapshot was initiated.
- State string
- Snapshot state.
- StorageTier string
- Storage tier in which the snapshot is stored.
- map[string]string
- Map of tags for the resource.
- VolumeId string
- Volume ID (e.g., vol-59fcb34e).
- VolumeSize int
- Size of the drive in GiBs.
- Filters
[]GetSnapshot Filter 
- MostRecent bool
- Owners []string
- RestorableBy []stringUser Ids 
- SnapshotIds []string
- arn String
- ARN of the EBS Snapshot.
- dataEncryption StringKey Id 
- The data encryption key identifier for the snapshot.
- description String
- Description for the snapshot
- encrypted Boolean
- Whether the snapshot is encrypted.
- id String
- The provider-assigned unique ID for this managed resource.
- kmsKey StringId 
- ARN for the KMS encryption key.
- outpostArn String
- ARN of the Outpost on which the snapshot is stored.
- ownerAlias String
- Value from an Amazon-maintained list (amazon,aws-marketplace,microsoft) of snapshot owners.
- ownerId String
- AWS account ID of the EBS snapshot owner.
- snapshotId String
- Snapshot ID (e.g., snap-59fcb34e).
- startTime String
- Time stamp when the snapshot was initiated.
- state String
- Snapshot state.
- storageTier String
- Storage tier in which the snapshot is stored.
- Map<String,String>
- Map of tags for the resource.
- volumeId String
- Volume ID (e.g., vol-59fcb34e).
- volumeSize Integer
- Size of the drive in GiBs.
- filters
List<GetSnapshot Filter> 
- mostRecent Boolean
- owners List<String>
- restorableBy List<String>User Ids 
- snapshotIds List<String>
- arn string
- ARN of the EBS Snapshot.
- dataEncryption stringKey Id 
- The data encryption key identifier for the snapshot.
- description string
- Description for the snapshot
- encrypted boolean
- Whether the snapshot is encrypted.
- id string
- The provider-assigned unique ID for this managed resource.
- kmsKey stringId 
- ARN for the KMS encryption key.
- outpostArn string
- ARN of the Outpost on which the snapshot is stored.
- ownerAlias string
- Value from an Amazon-maintained list (amazon,aws-marketplace,microsoft) of snapshot owners.
- ownerId string
- AWS account ID of the EBS snapshot owner.
- snapshotId string
- Snapshot ID (e.g., snap-59fcb34e).
- startTime string
- Time stamp when the snapshot was initiated.
- state string
- Snapshot state.
- storageTier string
- Storage tier in which the snapshot is stored.
- {[key: string]: string}
- Map of tags for the resource.
- volumeId string
- Volume ID (e.g., vol-59fcb34e).
- volumeSize number
- Size of the drive in GiBs.
- filters
GetSnapshot Filter[] 
- mostRecent boolean
- owners string[]
- restorableBy string[]User Ids 
- snapshotIds string[]
- arn str
- ARN of the EBS Snapshot.
- data_encryption_ strkey_ id 
- The data encryption key identifier for the snapshot.
- description str
- Description for the snapshot
- encrypted bool
- Whether the snapshot is encrypted.
- id str
- The provider-assigned unique ID for this managed resource.
- kms_key_ strid 
- ARN for the KMS encryption key.
- outpost_arn str
- ARN of the Outpost on which the snapshot is stored.
- owner_alias str
- Value from an Amazon-maintained list (amazon,aws-marketplace,microsoft) of snapshot owners.
- owner_id str
- AWS account ID of the EBS snapshot owner.
- snapshot_id str
- Snapshot ID (e.g., snap-59fcb34e).
- start_time str
- Time stamp when the snapshot was initiated.
- state str
- Snapshot state.
- storage_tier str
- Storage tier in which the snapshot is stored.
- Mapping[str, str]
- Map of tags for the resource.
- volume_id str
- Volume ID (e.g., vol-59fcb34e).
- volume_size int
- Size of the drive in GiBs.
- filters
Sequence[GetSnapshot Filter] 
- most_recent bool
- owners Sequence[str]
- restorable_by_ Sequence[str]user_ ids 
- snapshot_ids Sequence[str]
- arn String
- ARN of the EBS Snapshot.
- dataEncryption StringKey Id 
- The data encryption key identifier for the snapshot.
- description String
- Description for the snapshot
- encrypted Boolean
- Whether the snapshot is encrypted.
- id String
- The provider-assigned unique ID for this managed resource.
- kmsKey StringId 
- ARN for the KMS encryption key.
- outpostArn String
- ARN of the Outpost on which the snapshot is stored.
- ownerAlias String
- Value from an Amazon-maintained list (amazon,aws-marketplace,microsoft) of snapshot owners.
- ownerId String
- AWS account ID of the EBS snapshot owner.
- snapshotId String
- Snapshot ID (e.g., snap-59fcb34e).
- startTime String
- Time stamp when the snapshot was initiated.
- state String
- Snapshot state.
- storageTier String
- Storage tier in which the snapshot is stored.
- Map<String>
- Map of tags for the resource.
- volumeId String
- Volume ID (e.g., vol-59fcb34e).
- volumeSize Number
- Size of the drive in GiBs.
- filters List<Property Map>
- mostRecent Boolean
- owners List<String>
- restorableBy List<String>User Ids 
- snapshotIds List<String>
Supporting Types
GetSnapshotFilter  
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the awsTerraform Provider.