1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. ImageBlockPublicAccess

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.ec2.ImageBlockPublicAccess

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides a regional public access block for AMIs. This prevents AMIs from being made publicly accessible. If you already have public AMIs, they will remain publicly available.

    NOTE: Deleting this resource does not change the block public access value, the resource in simply removed from state instead.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    // Prevent making AMIs publicly accessible in the region and account for which the provider is configured
    const test = new aws.ec2.ImageBlockPublicAccess("test", {state: "block-new-sharing"});
    
    import pulumi
    import pulumi_aws as aws
    
    # Prevent making AMIs publicly accessible in the region and account for which the provider is configured
    test = aws.ec2.ImageBlockPublicAccess("test", state="block-new-sharing")
    
    package main
    
    import (
    	"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 {
    		// Prevent making AMIs publicly accessible in the region and account for which the provider is configured
    		_, err := ec2.NewImageBlockPublicAccess(ctx, "test", &ec2.ImageBlockPublicAccessArgs{
    			State: pulumi.String("block-new-sharing"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        // Prevent making AMIs publicly accessible in the region and account for which the provider is configured
        var test = new Aws.Ec2.ImageBlockPublicAccess("test", new()
        {
            State = "block-new-sharing",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.ImageBlockPublicAccess;
    import com.pulumi.aws.ec2.ImageBlockPublicAccessArgs;
    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) {
            // Prevent making AMIs publicly accessible in the region and account for which the provider is configured
            var test = new ImageBlockPublicAccess("test", ImageBlockPublicAccessArgs.builder()
                .state("block-new-sharing")
                .build());
    
        }
    }
    
    resources:
      # Prevent making AMIs publicly accessible in the region and account for which the provider is configured
      test:
        type: aws:ec2:ImageBlockPublicAccess
        properties:
          state: block-new-sharing
    

    Create ImageBlockPublicAccess Resource

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

    Constructor syntax

    new ImageBlockPublicAccess(name: string, args: ImageBlockPublicAccessArgs, opts?: CustomResourceOptions);
    @overload
    def ImageBlockPublicAccess(resource_name: str,
                               args: ImageBlockPublicAccessArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def ImageBlockPublicAccess(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               state: Optional[str] = None)
    func NewImageBlockPublicAccess(ctx *Context, name string, args ImageBlockPublicAccessArgs, opts ...ResourceOption) (*ImageBlockPublicAccess, error)
    public ImageBlockPublicAccess(string name, ImageBlockPublicAccessArgs args, CustomResourceOptions? opts = null)
    public ImageBlockPublicAccess(String name, ImageBlockPublicAccessArgs args)
    public ImageBlockPublicAccess(String name, ImageBlockPublicAccessArgs args, CustomResourceOptions options)
    
    type: aws:ec2:ImageBlockPublicAccess
    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 ImageBlockPublicAccessArgs
    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 ImageBlockPublicAccessArgs
    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 ImageBlockPublicAccessArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ImageBlockPublicAccessArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ImageBlockPublicAccessArgs
    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 imageBlockPublicAccessResource = new Aws.Ec2.ImageBlockPublicAccess("imageBlockPublicAccessResource", new()
    {
        State = "string",
    });
    
    example, err := ec2.NewImageBlockPublicAccess(ctx, "imageBlockPublicAccessResource", &ec2.ImageBlockPublicAccessArgs{
    	State: pulumi.String("string"),
    })
    
    var imageBlockPublicAccessResource = new ImageBlockPublicAccess("imageBlockPublicAccessResource", ImageBlockPublicAccessArgs.builder()
        .state("string")
        .build());
    
    image_block_public_access_resource = aws.ec2.ImageBlockPublicAccess("imageBlockPublicAccessResource", state="string")
    
    const imageBlockPublicAccessResource = new aws.ec2.ImageBlockPublicAccess("imageBlockPublicAccessResource", {state: "string"});
    
    type: aws:ec2:ImageBlockPublicAccess
    properties:
        state: string
    

    ImageBlockPublicAccess 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 ImageBlockPublicAccess resource accepts the following input properties:

    State string
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    State string
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    state String
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    state string
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    state str
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    state String
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ImageBlockPublicAccess 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 ImageBlockPublicAccess Resource

    Get an existing ImageBlockPublicAccess 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?: ImageBlockPublicAccessState, opts?: CustomResourceOptions): ImageBlockPublicAccess
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            state: Optional[str] = None) -> ImageBlockPublicAccess
    func GetImageBlockPublicAccess(ctx *Context, name string, id IDInput, state *ImageBlockPublicAccessState, opts ...ResourceOption) (*ImageBlockPublicAccess, error)
    public static ImageBlockPublicAccess Get(string name, Input<string> id, ImageBlockPublicAccessState? state, CustomResourceOptions? opts = null)
    public static ImageBlockPublicAccess get(String name, Output<String> id, ImageBlockPublicAccessState 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:
    State string
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    State string
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    state String
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    state string
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    state str
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.
    state String
    The state of block public access for AMIs at the account level in the configured AWS Region. Valid values: unblocked and block-new-sharing.

    Import

    You cannot import this resource.

    To learn more about importing existing cloud resources, see Importing resources.

    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

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi