getSnapshot

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"],
},
])
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 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
})
}
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

Return

A collection of values returned by getSnapshot.

Parameters

argument

A collection of arguments for invoking getSnapshot.


suspend fun getSnapshot(filters: List<GetSnapshotFilter>? = null, mostRecent: Boolean? = null, owners: List<String>? = null, restorableByUserIds: List<String>? = null, snapshotIds: List<String>? = null, tags: Map<String, String>? = null): GetSnapshotResult

Return

A collection of values returned by getSnapshot.

Parameters

filters

One or more name/value pairs to filter off of. There are several valid keys, for a full reference, check out 1.

mostRecent

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

owners

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

restorableByUserIds

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

snapshotIds

Returns information on a specific snapshot_id.

tags

Map of tags for the resource.

See also


suspend fun getSnapshot(argument: suspend GetSnapshotPlainArgsBuilder.() -> Unit): GetSnapshotResult

Return

A collection of values returned by getSnapshot.

Parameters

argument

Builder for com.pulumi.aws.ebs.kotlin.inputs.GetSnapshotPlainArgs.

See also