1. Packages
  2. AWS
  3. API Docs
  4. ec2
  5. SnapshotCreateVolumePermission
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.ec2.SnapshotCreateVolumePermission

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

    Adds permission to create volumes off of a given EBS Snapshot.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.ebs.Volume("example", {
        availabilityZone: "us-west-2a",
        size: 40,
    });
    const exampleSnapshot = new aws.ebs.Snapshot("example_snapshot", {volumeId: example.id});
    const examplePerm = new aws.ec2.SnapshotCreateVolumePermission("example_perm", {
        snapshotId: exampleSnapshot.id,
        accountId: "12345678",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.ebs.Volume("example",
        availability_zone="us-west-2a",
        size=40)
    example_snapshot = aws.ebs.Snapshot("example_snapshot", volume_id=example.id)
    example_perm = aws.ec2.SnapshotCreateVolumePermission("example_perm",
        snapshot_id=example_snapshot.id,
        account_id="12345678")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ebs"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ebs.NewVolume(ctx, "example", &ebs.VolumeArgs{
    			AvailabilityZone: pulumi.String("us-west-2a"),
    			Size:             pulumi.Int(40),
    		})
    		if err != nil {
    			return err
    		}
    		exampleSnapshot, err := ebs.NewSnapshot(ctx, "example_snapshot", &ebs.SnapshotArgs{
    			VolumeId: example.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ec2.NewSnapshotCreateVolumePermission(ctx, "example_perm", &ec2.SnapshotCreateVolumePermissionArgs{
    			SnapshotId: exampleSnapshot.ID(),
    			AccountId:  pulumi.String("12345678"),
    		})
    		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 example = new Aws.Ebs.Volume("example", new()
        {
            AvailabilityZone = "us-west-2a",
            Size = 40,
        });
    
        var exampleSnapshot = new Aws.Ebs.Snapshot("example_snapshot", new()
        {
            VolumeId = example.Id,
        });
    
        var examplePerm = new Aws.Ec2.SnapshotCreateVolumePermission("example_perm", new()
        {
            SnapshotId = exampleSnapshot.Id,
            AccountId = "12345678",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ebs.Volume;
    import com.pulumi.aws.ebs.VolumeArgs;
    import com.pulumi.aws.ebs.Snapshot;
    import com.pulumi.aws.ebs.SnapshotArgs;
    import com.pulumi.aws.ec2.SnapshotCreateVolumePermission;
    import com.pulumi.aws.ec2.SnapshotCreateVolumePermissionArgs;
    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) {
            var example = new Volume("example", VolumeArgs.builder()
                .availabilityZone("us-west-2a")
                .size(40)
                .build());
    
            var exampleSnapshot = new Snapshot("exampleSnapshot", SnapshotArgs.builder()
                .volumeId(example.id())
                .build());
    
            var examplePerm = new SnapshotCreateVolumePermission("examplePerm", SnapshotCreateVolumePermissionArgs.builder()
                .snapshotId(exampleSnapshot.id())
                .accountId("12345678")
                .build());
    
        }
    }
    
    resources:
      examplePerm:
        type: aws:ec2:SnapshotCreateVolumePermission
        name: example_perm
        properties:
          snapshotId: ${exampleSnapshot.id}
          accountId: '12345678'
      example:
        type: aws:ebs:Volume
        properties:
          availabilityZone: us-west-2a
          size: 40
      exampleSnapshot:
        type: aws:ebs:Snapshot
        name: example_snapshot
        properties:
          volumeId: ${example.id}
    

    Create SnapshotCreateVolumePermission Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new SnapshotCreateVolumePermission(name: string, args: SnapshotCreateVolumePermissionArgs, opts?: CustomResourceOptions);
    @overload
    def SnapshotCreateVolumePermission(resource_name: str,
                                       args: SnapshotCreateVolumePermissionArgs,
                                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def SnapshotCreateVolumePermission(resource_name: str,
                                       opts: Optional[ResourceOptions] = None,
                                       account_id: Optional[str] = None,
                                       snapshot_id: Optional[str] = None)
    func NewSnapshotCreateVolumePermission(ctx *Context, name string, args SnapshotCreateVolumePermissionArgs, opts ...ResourceOption) (*SnapshotCreateVolumePermission, error)
    public SnapshotCreateVolumePermission(string name, SnapshotCreateVolumePermissionArgs args, CustomResourceOptions? opts = null)
    public SnapshotCreateVolumePermission(String name, SnapshotCreateVolumePermissionArgs args)
    public SnapshotCreateVolumePermission(String name, SnapshotCreateVolumePermissionArgs args, CustomResourceOptions options)
    
    type: aws:ec2:SnapshotCreateVolumePermission
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args SnapshotCreateVolumePermissionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args SnapshotCreateVolumePermissionArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args SnapshotCreateVolumePermissionArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SnapshotCreateVolumePermissionArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SnapshotCreateVolumePermissionArgs
    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 snapshotCreateVolumePermissionResource = new Aws.Ec2.SnapshotCreateVolumePermission("snapshotCreateVolumePermissionResource", new()
    {
        AccountId = "string",
        SnapshotId = "string",
    });
    
    example, err := ec2.NewSnapshotCreateVolumePermission(ctx, "snapshotCreateVolumePermissionResource", &ec2.SnapshotCreateVolumePermissionArgs{
    	AccountId:  pulumi.String("string"),
    	SnapshotId: pulumi.String("string"),
    })
    
    var snapshotCreateVolumePermissionResource = new SnapshotCreateVolumePermission("snapshotCreateVolumePermissionResource", SnapshotCreateVolumePermissionArgs.builder()
        .accountId("string")
        .snapshotId("string")
        .build());
    
    snapshot_create_volume_permission_resource = aws.ec2.SnapshotCreateVolumePermission("snapshotCreateVolumePermissionResource",
        account_id="string",
        snapshot_id="string")
    
    const snapshotCreateVolumePermissionResource = new aws.ec2.SnapshotCreateVolumePermission("snapshotCreateVolumePermissionResource", {
        accountId: "string",
        snapshotId: "string",
    });
    
    type: aws:ec2:SnapshotCreateVolumePermission
    properties:
        accountId: string
        snapshotId: string
    

    SnapshotCreateVolumePermission Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The SnapshotCreateVolumePermission resource accepts the following input properties:

    AccountId string
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    SnapshotId string
    A snapshot ID
    AccountId string
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    SnapshotId string
    A snapshot ID
    accountId String
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    snapshotId String
    A snapshot ID
    accountId string
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    snapshotId string
    A snapshot ID
    account_id str
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    snapshot_id str
    A snapshot ID
    accountId String
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    snapshotId String
    A snapshot ID

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SnapshotCreateVolumePermission resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing SnapshotCreateVolumePermission Resource

    Get an existing SnapshotCreateVolumePermission 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?: SnapshotCreateVolumePermissionState, opts?: CustomResourceOptions): SnapshotCreateVolumePermission
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            snapshot_id: Optional[str] = None) -> SnapshotCreateVolumePermission
    func GetSnapshotCreateVolumePermission(ctx *Context, name string, id IDInput, state *SnapshotCreateVolumePermissionState, opts ...ResourceOption) (*SnapshotCreateVolumePermission, error)
    public static SnapshotCreateVolumePermission Get(string name, Input<string> id, SnapshotCreateVolumePermissionState? state, CustomResourceOptions? opts = null)
    public static SnapshotCreateVolumePermission get(String name, Output<String> id, SnapshotCreateVolumePermissionState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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
    The unique name of the resulting resource.
    id
    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:
    AccountId string
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    SnapshotId string
    A snapshot ID
    AccountId string
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    SnapshotId string
    A snapshot ID
    accountId String
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    snapshotId String
    A snapshot ID
    accountId string
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    snapshotId string
    A snapshot ID
    account_id str
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    snapshot_id str
    A snapshot ID
    accountId String
    An AWS Account ID to add create volume permissions. The AWS Account cannot be the snapshot's owner
    snapshotId String
    A snapshot ID

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi