Skip to main content

protections

Creates, updates, deletes or gets a protection resource or lists protections in a region

Overview

Nameprotections
TypeResource
DescriptionEnables AWS Shield Advanced for a specific AWS resource. The resource can be an Amazon CloudFront distribution, Amazon Route 53 hosted zone, AWS Global Accelerator standard accelerator, Elastic IP Address, Application Load Balancer, or a Classic Load Balancer. You can protect Amazon EC2 instances and Network Load Balancers by association with protected Amazon EC2 Elastic IP addresses.
Idawscc.shield.protections

Fields

NameDatatypeDescription
protection_idstringThe unique identifier (ID) of the protection.
protection_arnstringThe ARN (Amazon Resource Name) of the protection.
namestringFriendly name for the Protection.
resource_arnstringThe ARN (Amazon Resource Name) of the resource to be protected.
health_check_arnsarrayThe Amazon Resource Names (ARNs) of the health check to associate with the protection.
application_layer_automatic_response_configurationobjectThe automatic application layer DDoS mitigation settings for a Protection. This configuration determines whether Shield Advanced automatically manages rules in the web ACL in order to respond to application layer events that Shield Advanced determines to be DDoS attacks.
tagsarrayOne or more tag key-value pairs for the Protection object.
regionstringAWS region.

For more information, see AWS::Shield::Protection.

Methods

NameResourceAccessible byRequired Params
create_resourceprotectionsINSERTName, ResourceArn, region
delete_resourceprotectionsDELETEIdentifier, region
update_resourceprotectionsUPDATEIdentifier, PatchDocument, region
list_resourcesprotections_list_onlySELECTregion
get_resourceprotectionsSELECTIdentifier, region

SELECT examples

Gets all properties from an individual protection.

SELECT
region,
protection_id,
protection_arn,
name,
resource_arn,
health_check_arns,
application_layer_automatic_response_configuration,
tags
FROM awscc.shield.protections
WHERE
region = 'us-east-1' AND
Identifier = '{{ protection_arn }}';

INSERT example

Use the following StackQL query and manifest file to create a new protection resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.shield.protections (
Name,
ResourceArn,
region
)
SELECT
'{{ name }}',
'{{ resource_arn }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a protection resource, using stack-deploy.

/*+ update */
UPDATE awscc.shield.protections
SET PatchDocument = string('{{ {
"HealthCheckArns": health_check_arns,
"ApplicationLayerAutomaticResponseConfiguration": application_layer_automatic_response_configuration,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ protection_arn }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.shield.protections
WHERE
Identifier = '{{ protection_arn }}' AND
region = 'us-east-1'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the protections resource, the following permissions are required:

shield:CreateProtection,
shield:DeleteProtection,
shield:DescribeProtection,
shield:ListProtections,
shield:EnableApplicationLayerAutomaticResponse,
shield:AssociateHealthCheck,
shield:TagResource,
ec2:DescribeAddresses,
elasticloadbalancing:DescribeLoadBalancers,
route53:GetHealthCheck,
iam:GetRole,
iam:CreateServiceLinkedRole,
wafv2:GetWebACLForResource,
wafv2:GetWebACL