1. Packages
  2. AWS
  3. API Docs
  4. shield
  5. ApplicationLayerAutomaticResponse
AWS v6.56.1 published on Thursday, Oct 17, 2024 by Pulumi

aws.shield.ApplicationLayerAutomaticResponse

Explore with Pulumi AI

aws logo
AWS v6.56.1 published on Thursday, Oct 17, 2024 by Pulumi

    Resource for managing an AWS Shield Application Layer Automatic Response for automatic DDoS mitigation.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const current = aws.getRegion({});
    const currentGetCallerIdentity = aws.getCallerIdentity({});
    const currentGetPartition = aws.getPartition({});
    const config = new pulumi.Config();
    // The Cloudfront Distribution on which to enable the Application Layer Automatic Response.
    const distributionId = config.require("distributionId");
    const example = new aws.shield.ApplicationLayerAutomaticResponse("example", {
        resourceArn: Promise.all([currentGetPartition, currentGetCallerIdentity]).then(([currentGetPartition, currentGetCallerIdentity]) => `arn:${currentGetPartition.partition}:cloudfront:${currentGetCallerIdentity.accountId}:distribution/${distributionId}`),
        action: "COUNT",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    current = aws.get_region()
    current_get_caller_identity = aws.get_caller_identity()
    current_get_partition = aws.get_partition()
    config = pulumi.Config()
    # The Cloudfront Distribution on which to enable the Application Layer Automatic Response.
    distribution_id = config.require("distributionId")
    example = aws.shield.ApplicationLayerAutomaticResponse("example",
        resource_arn=f"arn:{current_get_partition.partition}:cloudfront:{current_get_caller_identity.account_id}:distribution/{distribution_id}",
        action="COUNT")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/shield"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aws.GetRegion(ctx, &aws.GetRegionArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		currentGetCallerIdentity, err := aws.GetCallerIdentity(ctx, &aws.GetCallerIdentityArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		currentGetPartition, err := aws.GetPartition(ctx, &aws.GetPartitionArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		cfg := config.New(ctx, "")
    		// The Cloudfront Distribution on which to enable the Application Layer Automatic Response.
    		distributionId := cfg.Require("distributionId")
    		_, err = shield.NewApplicationLayerAutomaticResponse(ctx, "example", &shield.ApplicationLayerAutomaticResponseArgs{
    			ResourceArn: pulumi.Sprintf("arn:%v:cloudfront:%v:distribution/%v", currentGetPartition.Partition, currentGetCallerIdentity.AccountId, distributionId),
    			Action:      pulumi.String("COUNT"),
    		})
    		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 current = Aws.GetRegion.Invoke();
    
        var currentGetCallerIdentity = Aws.GetCallerIdentity.Invoke();
    
        var currentGetPartition = Aws.GetPartition.Invoke();
    
        var config = new Config();
        // The Cloudfront Distribution on which to enable the Application Layer Automatic Response.
        var distributionId = config.Require("distributionId");
        var example = new Aws.Shield.ApplicationLayerAutomaticResponse("example", new()
        {
            ResourceArn = Output.Tuple(currentGetPartition, currentGetCallerIdentity).Apply(values =>
            {
                var currentGetPartition = values.Item1;
                var currentGetCallerIdentity = values.Item2;
                return $"arn:{currentGetPartition.Apply(getPartitionResult => getPartitionResult.Partition)}:cloudfront:{currentGetCallerIdentity.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId)}:distribution/{distributionId}";
            }),
            Action = "COUNT",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.AwsFunctions;
    import com.pulumi.aws.inputs.GetRegionArgs;
    import com.pulumi.aws.inputs.GetCallerIdentityArgs;
    import com.pulumi.aws.inputs.GetPartitionArgs;
    import com.pulumi.aws.shield.ApplicationLayerAutomaticResponse;
    import com.pulumi.aws.shield.ApplicationLayerAutomaticResponseArgs;
    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 config = ctx.config();
            final var current = AwsFunctions.getRegion();
    
            final var currentGetCallerIdentity = AwsFunctions.getCallerIdentity();
    
            final var currentGetPartition = AwsFunctions.getPartition();
    
            final var distributionId = config.get("distributionId");
            var example = new ApplicationLayerAutomaticResponse("example", ApplicationLayerAutomaticResponseArgs.builder()
                .resourceArn(String.format("arn:%s:cloudfront:%s:distribution/%s", currentGetPartition.applyValue(getPartitionResult -> getPartitionResult.partition()),currentGetCallerIdentity.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()),distributionId))
                .action("COUNT")
                .build());
    
        }
    }
    
    configuration:
      distributionId:
        type: string
    resources:
      example:
        type: aws:shield:ApplicationLayerAutomaticResponse
        properties:
          resourceArn: arn:${currentGetPartition.partition}:cloudfront:${currentGetCallerIdentity.accountId}:distribution/${distributionId}
          action: COUNT
    variables:
      current:
        fn::invoke:
          Function: aws:getRegion
          Arguments: {}
      currentGetCallerIdentity:
        fn::invoke:
          Function: aws:getCallerIdentity
          Arguments: {}
      currentGetPartition:
        fn::invoke:
          Function: aws:getPartition
          Arguments: {}
    

    Create ApplicationLayerAutomaticResponse Resource

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

    Constructor syntax

    new ApplicationLayerAutomaticResponse(name: string, args: ApplicationLayerAutomaticResponseArgs, opts?: CustomResourceOptions);
    @overload
    def ApplicationLayerAutomaticResponse(resource_name: str,
                                          args: ApplicationLayerAutomaticResponseArgs,
                                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApplicationLayerAutomaticResponse(resource_name: str,
                                          opts: Optional[ResourceOptions] = None,
                                          action: Optional[str] = None,
                                          resource_arn: Optional[str] = None,
                                          timeouts: Optional[ApplicationLayerAutomaticResponseTimeoutsArgs] = None)
    func NewApplicationLayerAutomaticResponse(ctx *Context, name string, args ApplicationLayerAutomaticResponseArgs, opts ...ResourceOption) (*ApplicationLayerAutomaticResponse, error)
    public ApplicationLayerAutomaticResponse(string name, ApplicationLayerAutomaticResponseArgs args, CustomResourceOptions? opts = null)
    public ApplicationLayerAutomaticResponse(String name, ApplicationLayerAutomaticResponseArgs args)
    public ApplicationLayerAutomaticResponse(String name, ApplicationLayerAutomaticResponseArgs args, CustomResourceOptions options)
    
    type: aws:shield:ApplicationLayerAutomaticResponse
    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 ApplicationLayerAutomaticResponseArgs
    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 ApplicationLayerAutomaticResponseArgs
    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 ApplicationLayerAutomaticResponseArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ApplicationLayerAutomaticResponseArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ApplicationLayerAutomaticResponseArgs
    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 applicationLayerAutomaticResponseResource = new Aws.Shield.ApplicationLayerAutomaticResponse("applicationLayerAutomaticResponseResource", new()
    {
        Action = "string",
        ResourceArn = "string",
        Timeouts = new Aws.Shield.Inputs.ApplicationLayerAutomaticResponseTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
            Update = "string",
        },
    });
    
    example, err := shield.NewApplicationLayerAutomaticResponse(ctx, "applicationLayerAutomaticResponseResource", &shield.ApplicationLayerAutomaticResponseArgs{
    	Action:      pulumi.String("string"),
    	ResourceArn: pulumi.String("string"),
    	Timeouts: &shield.ApplicationLayerAutomaticResponseTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    		Update: pulumi.String("string"),
    	},
    })
    
    var applicationLayerAutomaticResponseResource = new ApplicationLayerAutomaticResponse("applicationLayerAutomaticResponseResource", ApplicationLayerAutomaticResponseArgs.builder()
        .action("string")
        .resourceArn("string")
        .timeouts(ApplicationLayerAutomaticResponseTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .update("string")
            .build())
        .build());
    
    application_layer_automatic_response_resource = aws.shield.ApplicationLayerAutomaticResponse("applicationLayerAutomaticResponseResource",
        action="string",
        resource_arn="string",
        timeouts={
            "create": "string",
            "delete": "string",
            "update": "string",
        })
    
    const applicationLayerAutomaticResponseResource = new aws.shield.ApplicationLayerAutomaticResponse("applicationLayerAutomaticResponseResource", {
        action: "string",
        resourceArn: "string",
        timeouts: {
            create: "string",
            "delete": "string",
            update: "string",
        },
    });
    
    type: aws:shield:ApplicationLayerAutomaticResponse
    properties:
        action: string
        resourceArn: string
        timeouts:
            create: string
            delete: string
            update: string
    

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

    Action string
    One of COUNT or BLOCK
    ResourceArn string
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    Timeouts ApplicationLayerAutomaticResponseTimeouts
    Action string
    One of COUNT or BLOCK
    ResourceArn string
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    Timeouts ApplicationLayerAutomaticResponseTimeoutsArgs
    action String
    One of COUNT or BLOCK
    resourceArn String
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    timeouts ApplicationLayerAutomaticResponseTimeouts
    action string
    One of COUNT or BLOCK
    resourceArn string
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    timeouts ApplicationLayerAutomaticResponseTimeouts
    action str
    One of COUNT or BLOCK
    resource_arn str
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    timeouts ApplicationLayerAutomaticResponseTimeoutsArgs
    action String
    One of COUNT or BLOCK
    resourceArn String
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    timeouts Property Map

    Outputs

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

    Get an existing ApplicationLayerAutomaticResponse 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?: ApplicationLayerAutomaticResponseState, opts?: CustomResourceOptions): ApplicationLayerAutomaticResponse
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            action: Optional[str] = None,
            resource_arn: Optional[str] = None,
            timeouts: Optional[ApplicationLayerAutomaticResponseTimeoutsArgs] = None) -> ApplicationLayerAutomaticResponse
    func GetApplicationLayerAutomaticResponse(ctx *Context, name string, id IDInput, state *ApplicationLayerAutomaticResponseState, opts ...ResourceOption) (*ApplicationLayerAutomaticResponse, error)
    public static ApplicationLayerAutomaticResponse Get(string name, Input<string> id, ApplicationLayerAutomaticResponseState? state, CustomResourceOptions? opts = null)
    public static ApplicationLayerAutomaticResponse get(String name, Output<String> id, ApplicationLayerAutomaticResponseState 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:
    Action string
    One of COUNT or BLOCK
    ResourceArn string
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    Timeouts ApplicationLayerAutomaticResponseTimeouts
    Action string
    One of COUNT or BLOCK
    ResourceArn string
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    Timeouts ApplicationLayerAutomaticResponseTimeoutsArgs
    action String
    One of COUNT or BLOCK
    resourceArn String
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    timeouts ApplicationLayerAutomaticResponseTimeouts
    action string
    One of COUNT or BLOCK
    resourceArn string
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    timeouts ApplicationLayerAutomaticResponseTimeouts
    action str
    One of COUNT or BLOCK
    resource_arn str
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    timeouts ApplicationLayerAutomaticResponseTimeoutsArgs
    action String
    One of COUNT or BLOCK
    resourceArn String
    ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
    timeouts Property Map

    Supporting Types

    ApplicationLayerAutomaticResponseTimeouts, ApplicationLayerAutomaticResponseTimeoutsArgs

    Create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Delete string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    Update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    Delete string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    Update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    delete String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    update String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    delete string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    update string
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    delete str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    update str
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    create String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    delete String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    update String
    A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

    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.56.1 published on Thursday, Oct 17, 2024 by Pulumi