AWS v6.60.0 published on Tuesday, Nov 19, 2024 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)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:ebs/getSnapshot:getSnapshot
arguments:
# arguments dictionary
The following arguments are supported:
- Filters
List<Get
Snapshot 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 List<string>
- Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
- Restorable
By List<string>User Ids - One or more AWS accounts IDs that can create volumes from the snapshot.
- Snapshot
Ids List<string> - Returns information on a specific snapshot_id.
- Dictionary<string, string>
- Map of tags for the resource.
- Filters
[]Get
Snapshot 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 []string
- Returns the snapshots owned by the specified owner id. Multiple owners can be specified.
- Restorable
By []stringUser Ids - One or more AWS accounts IDs that can create volumes from the snapshot.
- Snapshot
Ids []string - Returns information on a specific snapshot_id.
- map[string]string
- Map of tags for the resource.
- filters
List<Get
Snapshot 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 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.
- restorable
By List<String>User Ids - One or more AWS accounts IDs that can create volumes from the snapshot.
- snapshot
Ids List<String> - Returns information on a specific snapshot_id.
- Map<String,String>
- Map of tags for the resource.
- filters
Get
Snapshot 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 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.
- restorable
By string[]User Ids - One or more AWS accounts IDs that can create volumes from the snapshot.
- snapshot
Ids string[] - Returns information on a specific snapshot_id.
- {[key: string]: string}
- Map of tags for the resource.
- filters
Sequence[Get
Snapshot 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].
- most
Recent 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.
- restorable
By List<String>User Ids - One or more AWS accounts IDs that can create volumes from the snapshot.
- snapshot
Ids 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.
- Data
Encryption 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.
- Kms
Key stringId - ARN for the KMS encryption key.
- Outpost
Arn string - ARN of the Outpost on which the snapshot is stored.
- Owner
Alias string - Value from an Amazon-maintained list (
amazon
,aws-marketplace
,microsoft
) of snapshot owners. - Owner
Id string - AWS account ID of the EBS snapshot owner.
- Snapshot
Id string - Snapshot ID (e.g., snap-59fcb34e).
- Start
Time string - Time stamp when the snapshot was initiated.
- State string
- Snapshot state.
- Storage
Tier string - Storage tier in which the snapshot is stored.
- Dictionary<string, string>
- Map of tags for the resource.
- Volume
Id string - Volume ID (e.g., vol-59fcb34e).
- Volume
Size int - Size of the drive in GiBs.
- Filters
List<Get
Snapshot Filter> - Most
Recent bool - Owners List<string>
- Restorable
By List<string>User Ids - Snapshot
Ids List<string>
- Arn string
- ARN of the EBS Snapshot.
- Data
Encryption 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.
- Kms
Key stringId - ARN for the KMS encryption key.
- Outpost
Arn string - ARN of the Outpost on which the snapshot is stored.
- Owner
Alias string - Value from an Amazon-maintained list (
amazon
,aws-marketplace
,microsoft
) of snapshot owners. - Owner
Id string - AWS account ID of the EBS snapshot owner.
- Snapshot
Id string - Snapshot ID (e.g., snap-59fcb34e).
- Start
Time string - Time stamp when the snapshot was initiated.
- State string
- Snapshot state.
- Storage
Tier string - Storage tier in which the snapshot is stored.
- map[string]string
- Map of tags for the resource.
- Volume
Id string - Volume ID (e.g., vol-59fcb34e).
- Volume
Size int - Size of the drive in GiBs.
- Filters
[]Get
Snapshot Filter - Most
Recent bool - Owners []string
- Restorable
By []stringUser Ids - Snapshot
Ids []string
- arn String
- ARN of the EBS Snapshot.
- data
Encryption 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.
- kms
Key StringId - ARN for the KMS encryption key.
- outpost
Arn String - ARN of the Outpost on which the snapshot is stored.
- owner
Alias String - Value from an Amazon-maintained list (
amazon
,aws-marketplace
,microsoft
) of snapshot owners. - owner
Id String - AWS account ID of the EBS snapshot owner.
- snapshot
Id String - Snapshot ID (e.g., snap-59fcb34e).
- start
Time String - Time stamp when the snapshot was initiated.
- state String
- Snapshot state.
- storage
Tier String - Storage tier in which the snapshot is stored.
- Map<String,String>
- Map of tags for the resource.
- volume
Id String - Volume ID (e.g., vol-59fcb34e).
- volume
Size Integer - Size of the drive in GiBs.
- filters
List<Get
Snapshot Filter> - most
Recent Boolean - owners List<String>
- restorable
By List<String>User Ids - snapshot
Ids List<String>
- arn string
- ARN of the EBS Snapshot.
- data
Encryption 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.
- kms
Key stringId - ARN for the KMS encryption key.
- outpost
Arn string - ARN of the Outpost on which the snapshot is stored.
- owner
Alias string - Value from an Amazon-maintained list (
amazon
,aws-marketplace
,microsoft
) of snapshot owners. - owner
Id string - AWS account ID of the EBS snapshot owner.
- snapshot
Id string - Snapshot ID (e.g., snap-59fcb34e).
- start
Time string - Time stamp when the snapshot was initiated.
- state string
- Snapshot state.
- storage
Tier string - Storage tier in which the snapshot is stored.
- {[key: string]: string}
- Map of tags for the resource.
- volume
Id string - Volume ID (e.g., vol-59fcb34e).
- volume
Size number - Size of the drive in GiBs.
- filters
Get
Snapshot Filter[] - most
Recent boolean - owners string[]
- restorable
By string[]User Ids - snapshot
Ids 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[Get
Snapshot Filter] - most_
recent bool - owners Sequence[str]
- restorable_
by_ Sequence[str]user_ ids - snapshot_
ids Sequence[str]
- arn String
- ARN of the EBS Snapshot.
- data
Encryption 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.
- kms
Key StringId - ARN for the KMS encryption key.
- outpost
Arn String - ARN of the Outpost on which the snapshot is stored.
- owner
Alias String - Value from an Amazon-maintained list (
amazon
,aws-marketplace
,microsoft
) of snapshot owners. - owner
Id String - AWS account ID of the EBS snapshot owner.
- snapshot
Id String - Snapshot ID (e.g., snap-59fcb34e).
- start
Time String - Time stamp when the snapshot was initiated.
- state String
- Snapshot state.
- storage
Tier String - Storage tier in which the snapshot is stored.
- Map<String>
- Map of tags for the resource.
- volume
Id String - Volume ID (e.g., vol-59fcb34e).
- volume
Size Number - Size of the drive in GiBs.
- filters List<Property Map>
- most
Recent Boolean - owners List<String>
- restorable
By List<String>User Ids - snapshot
Ids 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
aws
Terraform Provider.