1. Packages
  2. AWS
  3. API Docs
  4. shield
  5. ApplicationLayerAutomaticResponse
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.shield.ApplicationLayerAutomaticResponse

Explore with Pulumi AI

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

});
Copy
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(GetRegionArgs.builder()
            .build());

        final var currentGetCallerIdentity = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
            .build());

        final var currentGetPartition = AwsFunctions.getPartition(GetPartitionArgs.builder()
            .build());

        final var distributionId = config.get("distributionId");
        var example = new ApplicationLayerAutomaticResponse("example", ApplicationLayerAutomaticResponseArgs.builder()
            .resourceArn(String.format("arn:%s:cloudfront:%s:distribution/%s", currentGetPartition.partition(),currentGetCallerIdentity.accountId(),distributionId))
            .action("COUNT")
            .build());

    }
}
Copy
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: {}
Copy

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 This property is required. string
The unique name of the resource.
args This property is required. ApplicationLayerAutomaticResponseArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. ApplicationLayerAutomaticResponseArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ApplicationLayerAutomaticResponseArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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",
    },
});
Copy
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"),
	},
})
Copy
var applicationLayerAutomaticResponseResource = new ApplicationLayerAutomaticResponse("applicationLayerAutomaticResponseResource", ApplicationLayerAutomaticResponseArgs.builder()
    .action("string")
    .resourceArn("string")
    .timeouts(ApplicationLayerAutomaticResponseTimeoutsArgs.builder()
        .create("string")
        .delete("string")
        .update("string")
        .build())
    .build());
Copy
application_layer_automatic_response_resource = aws.shield.ApplicationLayerAutomaticResponse("applicationLayerAutomaticResponseResource",
    action="string",
    resource_arn="string",
    timeouts={
        "create": "string",
        "delete": "string",
        "update": "string",
    })
Copy
const applicationLayerAutomaticResponseResource = new aws.shield.ApplicationLayerAutomaticResponse("applicationLayerAutomaticResponseResource", {
    action: "string",
    resourceArn: "string",
    timeouts: {
        create: "string",
        "delete": "string",
        update: "string",
    },
});
Copy
type: aws:shield:ApplicationLayerAutomaticResponse
properties:
    action: string
    resourceArn: string
    timeouts:
        create: string
        delete: string
        update: string
Copy

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

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ApplicationLayerAutomaticResponse resource accepts the following input properties:

Action This property is required. string
One of COUNT or BLOCK
ResourceArn This property is required. string
ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
Timeouts ApplicationLayerAutomaticResponseTimeouts
Action This property is required. string
One of COUNT or BLOCK
ResourceArn This property is required. string
ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
Timeouts ApplicationLayerAutomaticResponseTimeoutsArgs
action This property is required. String
One of COUNT or BLOCK
resourceArn This property is required. String
ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
timeouts ApplicationLayerAutomaticResponseTimeouts
action This property is required. string
One of COUNT or BLOCK
resourceArn This property is required. string
ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
timeouts ApplicationLayerAutomaticResponseTimeouts
action This property is required. str
One of COUNT or BLOCK
resource_arn This property is required. str
ARN of the resource to protect (Cloudfront Distributions and ALBs only at this time).
timeouts ApplicationLayerAutomaticResponseTimeoutsArgs
action This property is required. String
One of COUNT or BLOCK
resourceArn This property is required. 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)
resources:  _:    type: aws:shield:ApplicationLayerAutomaticResponse    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.