Table of Contents
A low-level client representing AWS Shield
This is the Shield Advanced API Reference . This guide is for developers who need detailed information about the Shield Advanced API actions, data types, and errors. For detailed information about WAF and Shield Advanced features and an overview of how to use the WAF and Shield Advanced APIs, see the WAF and Shield Developer Guide .
import boto3
client = boto3.client('shield')
These are the available methods:
Authorizes the Shield Response Team (SRT) to access the specified Amazon S3 bucket containing log data such as Application Load Balancer access logs, CloudFront logs, or logs from third party sources. You can associate up to 10 Amazon S3 buckets with your subscription.
To use the services of the SRT and make an AssociateDRTLogBucket request, you must be subscribed to the Business Support plan or the Enterprise Support plan .
See also: AWS API Documentation
Request Syntax
response = client.associate_drt_log_bucket(
LogBucket='string'
)
[REQUIRED]
The Amazon S3 bucket that contains the logs that you want to share.
{}
Response Structure
Exceptions
Authorizes the Shield Response Team (SRT) using the specified role, to access your Amazon Web Services account to assist with DDoS attack mitigation during potential attacks. This enables the SRT to inspect your WAF configuration and create or update WAF rules and web ACLs.
You can associate only one RoleArn with your subscription. If you submit an AssociateDRTRole request for an account that already has an associated role, the new RoleArn will replace the existing RoleArn .
Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to the role you will specify in the request. For more information see `Attaching and Detaching IAM Policies < https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html>`__ . The role must also trust the service principal drt.shield.amazonaws.com . For more information, see IAM JSON Policy Elements: Principal .
The SRT will have access only to your WAF and Shield resources. By submitting this request, you authorize the SRT to inspect your WAF and Shield configuration and create and update WAF rules and web ACLs on your behalf. The SRT takes these actions only if explicitly authorized by you.
You must have the iam:PassRole permission to make an AssociateDRTRole request. For more information, see Granting a User Permissions to Pass a Role to an Amazon Web Services Service .
To use the services of the SRT and make an AssociateDRTRole request, you must be subscribed to the Business Support plan or the Enterprise Support plan .
See also: AWS API Documentation
Request Syntax
response = client.associate_drt_role(
RoleArn='string'
)
[REQUIRED]
The Amazon Resource Name (ARN) of the role the SRT will use to access your Amazon Web Services account.
Prior to making the AssociateDRTRole request, you must attach the AWSShieldDRTAccessPolicy managed policy to this role. For more information see `Attaching and Detaching IAM Policies < https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html>`__ .
{}
Response Structure
Exceptions
Adds health-based detection to the Shield Advanced protection for a resource. Shield Advanced health-based detection uses the health of your Amazon Web Services resource to improve responsiveness and accuracy in attack detection and mitigation.
You define the health check in Route 53 and then associate it with your Shield Advanced protection. For more information, see Shield Advanced Health-Based Detection in the WAF Developer Guide .
See also: AWS API Documentation
Request Syntax
response = client.associate_health_check(
ProtectionId='string',
HealthCheckArn='string'
)
[REQUIRED]
The unique identifier (ID) for the Protection object to add the health check association to.
[REQUIRED]
The Amazon Resource Name (ARN) of the health check to associate with the protection.
dict
Response Syntax
{}
Response Structure
Exceptions
Initializes proactive engagement and sets the list of contacts for the Shield Response Team (SRT) to use. You must provide at least one phone number in the emergency contact list.
After you have initialized proactive engagement using this call, to disable or enable proactive engagement, use the calls DisableProactiveEngagement and EnableProactiveEngagement .
Note
This call defines the list of email addresses and phone numbers that the SRT can use to contact you for escalations to the SRT and to initiate proactive customer support.
The contacts that you provide in the request replace any contacts that were already defined. If you already have contacts defined and want to use them, retrieve the list using DescribeEmergencyContactSettings and then provide it to this call.
See also: AWS API Documentation
Request Syntax
response = client.associate_proactive_engagement_details(
EmergencyContactList=[
{
'EmailAddress': 'string',
'PhoneNumber': 'string',
'ContactNotes': 'string'
},
]
)
[REQUIRED]
A list of email addresses and phone numbers that the Shield Response Team (SRT) can use to contact you for escalations to the SRT and to initiate proactive customer support.
To enable proactive engagement, the contact list must include at least one phone number.
Note
The contacts that you provide here replace any contacts that were already defined. If you already have contacts defined and want to use them, retrieve the list using DescribeEmergencyContactSettings and then provide it here.
Contact information that the SRT can use to contact you if you have proactive engagement enabled, for escalations to the SRT and to initiate proactive customer support.
The email address for the contact.
The phone number for the contact.
Additional notes regarding the contact.
{}
Response Structure
Exceptions
Check if an operation can be paginated.
Enables Shield Advanced for a specific Amazon Web Services resource. The resource can be an Amazon CloudFront distribution, Elastic Load Balancing load balancer, Global Accelerator accelerator, Elastic IP Address, or an Amazon Route 53 hosted zone.
You can add protection to only a single resource with each CreateProtection request. If you want to add protection to multiple resources at once, use the WAF console . For more information see Getting Started with Shield Advanced and Add Shield Advanced Protection to more Amazon Web Services Resources .
See also: AWS API Documentation
Request Syntax
response = client.create_protection(
Name='string',
ResourceArn='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
[REQUIRED]
Friendly name for the Protection you are creating.
[REQUIRED]
The ARN (Amazon Resource Name) of the resource to be protected.
The ARN should be in one of the following formats:
One or more tag key-value pairs for the Protection object that is created.
A tag associated with an Amazon Web Services resource. Tags are key:value pairs that you can use to categorize and manage your resources, for purposes like billing or other management. Typically, the tag key represents a category, such as "environment", and the tag value represents a specific value within that category, such as "test," "development," or "production". Or you might set the tag key to "customer" and the value to the customer name or ID. You can specify one or more tags to add to each Amazon Web Services resource, up to 50 tags for a resource.
Part of the key:value pair that defines a tag. You can use a tag key to describe a category of information, such as "customer." Tag keys are case-sensitive.
Part of the key:value pair that defines a tag. You can use a tag value to describe a specific value within a category, such as "companyA" or "companyB." Tag values are case-sensitive.
dict
Response Syntax
{
'ProtectionId': 'string'
}
Response Structure
(dict) --
ProtectionId (string) --
The unique identifier (ID) for the Protection object that is created.
Exceptions
Creates a grouping of protected resources so they can be handled as a collective. This resource grouping improves the accuracy of detection and reduces false positives.
See also: AWS API Documentation
Request Syntax
response = client.create_protection_group(
ProtectionGroupId='string',
Aggregation='SUM'|'MEAN'|'MAX',
Pattern='ALL'|'ARBITRARY'|'BY_RESOURCE_TYPE',
ResourceType='CLOUDFRONT_DISTRIBUTION'|'ROUTE_53_HOSTED_ZONE'|'ELASTIC_IP_ALLOCATION'|'CLASSIC_LOAD_BALANCER'|'APPLICATION_LOAD_BALANCER'|'GLOBAL_ACCELERATOR',
Members=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
[REQUIRED]
The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.
[REQUIRED]
Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.
[REQUIRED]
The criteria to use to choose the protected resources for inclusion in the group. You can include all resources that have protections, provide a list of resource Amazon Resource Names (ARNs), or include all resources of a specified resource type.
The Amazon Resource Names (ARNs) of the resources to include in the protection group. You must set this when you set Pattern to ARBITRARY and you must not set it for any other Pattern setting.
One or more tag key-value pairs for the protection group.
A tag associated with an Amazon Web Services resource. Tags are key:value pairs that you can use to categorize and manage your resources, for purposes like billing or other management. Typically, the tag key represents a category, such as "environment", and the tag value represents a specific value within that category, such as "test," "development," or "production". Or you might set the tag key to "customer" and the value to the customer name or ID. You can specify one or more tags to add to each Amazon Web Services resource, up to 50 tags for a resource.
Part of the key:value pair that defines a tag. You can use a tag key to describe a category of information, such as "customer." Tag keys are case-sensitive.
Part of the key:value pair that defines a tag. You can use a tag value to describe a specific value within a category, such as "companyA" or "companyB." Tag values are case-sensitive.
dict
Response Syntax
{}
Response Structure
Exceptions
Activates Shield Advanced for an account.
When you initally create a subscription, your subscription is set to be automatically renewed at the end of the existing subscription period. You can change this by submitting an UpdateSubscription request.
See also: AWS API Documentation
Request Syntax
response = client.create_subscription()
{}
Response Structure
Exceptions
Deletes an Shield Advanced Protection .
See also: AWS API Documentation
Request Syntax
response = client.delete_protection(
ProtectionId='string'
)
[REQUIRED]
The unique identifier (ID) for the Protection object to be deleted.
{}
Response Structure
Exceptions
Removes the specified protection group.
See also: AWS API Documentation
Request Syntax
response = client.delete_protection_group(
ProtectionGroupId='string'
)
[REQUIRED]
The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.
{}
Response Structure
Exceptions
Removes Shield Advanced from an account. Shield Advanced requires a 1-year subscription commitment. You cannot delete a subscription prior to the completion of that commitment.
Danger
This operation is deprecated and may not function as expected. This operation should not be used going forward and is only kept for the purpose of backwards compatiblity.
See also: AWS API Documentation
Request Syntax
response = client.delete_subscription()
{}
Response Structure
Exceptions
Describes the details of a DDoS attack.
See also: AWS API Documentation
Request Syntax
response = client.describe_attack(
AttackId='string'
)
[REQUIRED]
The unique identifier (ID) for the attack that to be described.
{
'Attack': {
'AttackId': 'string',
'ResourceArn': 'string',
'SubResources': [
{
'Type': 'IP'|'URL',
'Id': 'string',
'AttackVectors': [
{
'VectorType': 'string',
'VectorCounters': [
{
'Name': 'string',
'Max': 123.0,
'Average': 123.0,
'Sum': 123.0,
'N': 123,
'Unit': 'string'
},
]
},
],
'Counters': [
{
'Name': 'string',
'Max': 123.0,
'Average': 123.0,
'Sum': 123.0,
'N': 123,
'Unit': 'string'
},
]
},
],
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'AttackCounters': [
{
'Name': 'string',
'Max': 123.0,
'Average': 123.0,
'Sum': 123.0,
'N': 123,
'Unit': 'string'
},
],
'AttackProperties': [
{
'AttackLayer': 'NETWORK'|'APPLICATION',
'AttackPropertyIdentifier': 'DESTINATION_URL'|'REFERRER'|'SOURCE_ASN'|'SOURCE_COUNTRY'|'SOURCE_IP_ADDRESS'|'SOURCE_USER_AGENT'|'WORDPRESS_PINGBACK_REFLECTOR'|'WORDPRESS_PINGBACK_SOURCE',
'TopContributors': [
{
'Name': 'string',
'Value': 123
},
],
'Unit': 'BITS'|'BYTES'|'PACKETS'|'REQUESTS',
'Total': 123
},
],
'Mitigations': [
{
'MitigationName': 'string'
},
]
}
}
Response Structure
The attack that is described.
The unique identifier (ID) of the attack.
The ARN (Amazon Resource Name) of the resource that was attacked.
If applicable, additional detail about the resource being attacked, for example, IP address or URL.
The attack information for the specified SubResource.
The SubResource type.
The unique identifier (ID) of the SubResource .
The list of attack types and associated counters.
A summary of information about the attack.
The attack type, for example, SNMP reflection or SYN flood.
The list of counters that describe the details of the attack.
The counter that describes a DDoS attack.
The counter name.
The maximum value of the counter for a specified time period.
The average value of the counter for a specified time period.
The total of counter values for a specified time period.
The number of counters for a specified time period.
The unit of the counters.
The counters that describe the details of the attack.
The counter that describes a DDoS attack.
The counter name.
The maximum value of the counter for a specified time period.
The average value of the counter for a specified time period.
The total of counter values for a specified time period.
The number of counters for a specified time period.
The unit of the counters.
The time the attack started, in Unix time in seconds. For more information see timestamp .
The time the attack ended, in Unix time in seconds. For more information see timestamp .
List of counters that describe the attack for the specified time period.
The counter that describes a DDoS attack.
The counter name.
The maximum value of the counter for a specified time period.
The average value of the counter for a specified time period.
The total of counter values for a specified time period.
The number of counters for a specified time period.
The unit of the counters.
The array of objects that provide details of the Shield event.
For infrastructure layer events (L3 and L4 events) after January 25, 2021, you can view metrics for top contributors in Amazon CloudWatch metrics. For more information, see Shield metrics and alarms in the WAF Developer Guide .
Details of a Shield event. This is provided as part of an AttackDetail .
The type of Shield event that was observed. NETWORK indicates layer 3 and layer 4 events and APPLICATION indicates layer 7 events.
For infrastructure layer events (L3 and L4 events) after January 25, 2021, you can view metrics for top contributors in Amazon CloudWatch metrics. For more information, see Shield metrics and alarms in the WAF Developer Guide .
Defines the Shield event property information that is provided. The WORDPRESS_PINGBACK_REFLECTOR and WORDPRESS_PINGBACK_SOURCE values are valid only for WordPress reflective pingback events.
Contributor objects for the top five contributors to a Shield event.
A contributor to the attack and their contribution.
The name of the contributor. This is dependent on the AttackPropertyIdentifier . For example, if the AttackPropertyIdentifier is SOURCE_COUNTRY , the Name could be United States .
The contribution of this contributor expressed in Protection units. For example 10,000 .
The unit used for the Contributor Value property.
The total contributions made to this Shield event by all contributors.
List of mitigation actions taken for the attack.
The mitigation applied to a DDoS attack.
The name of the mitigation taken for this attack.
Exceptions
Provides information about the number and type of attacks Shield has detected in the last year for all resources that belong to your account, regardless of whether you've defined Shield protections for them. This operation is available to Shield customers as well as to Shield Advanced customers.
The operation returns data for the time range of midnight UTC, one year ago, to midnight UTC, today. For example, if the current time is 2020-10-26 15:39:32 PDT , equal to 2020-10-26 22:39:32 UTC , then the time range for the attack data returned is from 2019-10-26 00:00:00 UTC to 2020-10-26 00:00:00 UTC .
The time range indicates the period covered by the attack statistics data items.
See also: AWS API Documentation
Request Syntax
response = client.describe_attack_statistics()
{
'TimeRange': {
'FromInclusive': datetime(2015, 1, 1),
'ToExclusive': datetime(2015, 1, 1)
},
'DataItems': [
{
'AttackVolume': {
'BitsPerSecond': {
'Max': 123.0
},
'PacketsPerSecond': {
'Max': 123.0
},
'RequestsPerSecond': {
'Max': 123.0
}
},
'AttackCount': 123
},
]
}
Response Structure
The time range.
The data that describes the attacks detected during the time period.
A single attack statistics data record. This is returned by DescribeAttackStatistics along with a time range indicating the time period that the attack statistics apply to.
Information about the volume of attacks during the time period. If the accompanying AttackCount is zero, this setting might be empty.
A statistics object that uses bits per second as the unit. This is included for network level attacks.
The maximum attack volume observed for the given unit.
A statistics object that uses packets per second as the unit. This is included for network level attacks.
The maximum attack volume observed for the given unit.
A statistics object that uses requests per second as the unit. This is included for application level attacks, and is only available for accounts that are subscribed to Shield Advanced.
The maximum attack volume observed for the given unit.
The number of attacks detected during the time period. This is always present, but might be zero.
Exceptions
Returns the current role and list of Amazon S3 log buckets used by the Shield Response Team (SRT) to access your Amazon Web Services account while assisting with attack mitigation.
See also: AWS API Documentation
Request Syntax
response = client.describe_drt_access()
{
'RoleArn': 'string',
'LogBucketList': [
'string',
]
}
Response Structure
The Amazon Resource Name (ARN) of the role the SRT used to access your Amazon Web Services account.
The list of Amazon S3 buckets accessed by the SRT.
Exceptions
A list of email addresses and phone numbers that the Shield Response Team (SRT) can use to contact you if you have proactive engagement enabled, for escalations to the SRT and to initiate proactive customer support.
See also: AWS API Documentation
Request Syntax
response = client.describe_emergency_contact_settings()
{
'EmergencyContactList': [
{
'EmailAddress': 'string',
'PhoneNumber': 'string',
'ContactNotes': 'string'
},
]
}
Response Structure
A list of email addresses and phone numbers that the Shield Response Team (SRT) can use to contact you if you have proactive engagement enabled, for escalations to the SRT and to initiate proactive customer support.
Contact information that the SRT can use to contact you if you have proactive engagement enabled, for escalations to the SRT and to initiate proactive customer support.
The email address for the contact.
The phone number for the contact.
Additional notes regarding the contact.
Exceptions
Lists the details of a Protection object.
See also: AWS API Documentation
Request Syntax
response = client.describe_protection(
ProtectionId='string',
ResourceArn='string'
)
dict
Response Syntax
{
'Protection': {
'Id': 'string',
'Name': 'string',
'ResourceArn': 'string',
'HealthCheckIds': [
'string',
],
'ProtectionArn': 'string'
}
}
Response Structure
(dict) --
Protection (dict) --
The Protection object that is described.
Id (string) --
The unique identifier (ID) of the protection.
Name (string) --
The name of the protection. For example, My CloudFront distributions .
ResourceArn (string) --
The ARN (Amazon Resource Name) of the Amazon Web Services resource that is protected.
HealthCheckIds (list) --
The unique identifier (ID) for the Route 53 health check that's associated with the protection.
ProtectionArn (string) --
The ARN (Amazon Resource Name) of the protection.
Exceptions
Returns the specification for the specified protection group.
See also: AWS API Documentation
Request Syntax
response = client.describe_protection_group(
ProtectionGroupId='string'
)
[REQUIRED]
The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.
{
'ProtectionGroup': {
'ProtectionGroupId': 'string',
'Aggregation': 'SUM'|'MEAN'|'MAX',
'Pattern': 'ALL'|'ARBITRARY'|'BY_RESOURCE_TYPE',
'ResourceType': 'CLOUDFRONT_DISTRIBUTION'|'ROUTE_53_HOSTED_ZONE'|'ELASTIC_IP_ALLOCATION'|'CLASSIC_LOAD_BALANCER'|'APPLICATION_LOAD_BALANCER'|'GLOBAL_ACCELERATOR',
'Members': [
'string',
],
'ProtectionGroupArn': 'string'
}
}
Response Structure
A grouping of protected resources that you and Shield Advanced can monitor as a collective. This resource grouping improves the accuracy of detection and reduces false positives.
The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.
Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.
The criteria to use to choose the protected resources for inclusion in the group. You can include all resources that have protections, provide a list of resource Amazon Resource Names (ARNs), or include all resources of a specified resource type.
The resource type to include in the protection group. All protected resources of this type are included in the protection group. You must set this when you set Pattern to BY_RESOURCE_TYPE and you must not set it for any other Pattern setting.
The Amazon Resource Names (ARNs) of the resources to include in the protection group. You must set this when you set Pattern to ARBITRARY and you must not set it for any other Pattern setting.
The ARN (Amazon Resource Name) of the protection group.
Exceptions
Provides details about the Shield Advanced subscription for an account.
See also: AWS API Documentation
Request Syntax
response = client.describe_subscription()
{
'Subscription': {
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'TimeCommitmentInSeconds': 123,
'AutoRenew': 'ENABLED'|'DISABLED',
'Limits': [
{
'Type': 'string',
'Max': 123
},
],
'ProactiveEngagementStatus': 'ENABLED'|'DISABLED'|'PENDING',
'SubscriptionLimits': {
'ProtectionLimits': {
'ProtectedResourceTypeLimits': [
{
'Type': 'string',
'Max': 123
},
]
},
'ProtectionGroupLimits': {
'MaxProtectionGroups': 123,
'PatternTypeLimits': {
'ArbitraryPatternLimits': {
'MaxMembers': 123
}
}
}
},
'SubscriptionArn': 'string'
}
}
Response Structure
The Shield Advanced subscription details for an account.
The start time of the subscription, in Unix time in seconds. For more information see timestamp .
The date and time your subscription will end.
The length, in seconds, of the Shield Advanced subscription for the account.
If ENABLED , the subscription will be automatically renewed at the end of the existing subscription period.
When you initally create a subscription, AutoRenew is set to ENABLED . You can change this by submitting an UpdateSubscription request. If the UpdateSubscription request does not included a value for AutoRenew , the existing value for AutoRenew remains unchanged.
Specifies how many protections of a given type you can create.
Specifies how many protections of a given type you can create.
The type of protection.
The maximum number of protections that can be created for the specified Type .
If ENABLED , the Shield Response Team (SRT) will use email and phone to notify contacts about escalations to the SRT and to initiate proactive customer support.
If PENDING , you have requested proactive engagement and the request is pending. The status changes to ENABLED when your request is fully processed.
If DISABLED , the SRT will not proactively notify contacts about escalations or to initiate proactive customer support.
Limits settings for your subscription.
Limits settings on protections for your subscription.
The maximum number of resource types that you can specify in a protection.
Specifies how many protections of a given type you can create.
The type of protection.
The maximum number of protections that can be created for the specified Type .
Limits settings on protection groups for your subscription.
The maximum number of protection groups that you can have at one time.
Limits settings by pattern type in the protection groups for your subscription.
Limits settings on protection groups with arbitrary pattern type.
The maximum number of resources you can specify for a single arbitrary pattern in a protection group.
The ARN (Amazon Resource Name) of the subscription.
Exceptions
Removes authorization from the Shield Response Team (SRT) to notify contacts about escalations to the SRT and to initiate proactive customer support.
See also: AWS API Documentation
Request Syntax
response = client.disable_proactive_engagement()
{}
Response Structure
Exceptions
Removes the Shield Response Team's (SRT) access to the specified Amazon S3 bucket containing the logs that you shared previously.
To make a DisassociateDRTLogBucket request, you must be subscribed to the Business Support plan or the Enterprise Support plan . However, if you are not subscribed to one of these support plans, but had been previously and had granted the SRT access to your account, you can submit a DisassociateDRTLogBucket request to remove this access.
See also: AWS API Documentation
Request Syntax
response = client.disassociate_drt_log_bucket(
LogBucket='string'
)
[REQUIRED]
The Amazon S3 bucket that contains the logs that you want to share.
{}
Response Structure
Exceptions
Removes the Shield Response Team's (SRT) access to your Amazon Web Services account.
To make a DisassociateDRTRole request, you must be subscribed to the Business Support plan or the Enterprise Support plan . However, if you are not subscribed to one of these support plans, but had been previously and had granted the SRT access to your account, you can submit a DisassociateDRTRole request to remove this access.
See also: AWS API Documentation
Request Syntax
response = client.disassociate_drt_role()
{}
Response Structure
Exceptions
Removes health-based detection from the Shield Advanced protection for a resource. Shield Advanced health-based detection uses the health of your Amazon Web Services resource to improve responsiveness and accuracy in attack detection and mitigation.
You define the health check in Route 53 and then associate or disassociate it with your Shield Advanced protection. For more information, see Shield Advanced Health-Based Detection in the WAF Developer Guide .
See also: AWS API Documentation
Request Syntax
response = client.disassociate_health_check(
ProtectionId='string',
HealthCheckArn='string'
)
[REQUIRED]
The unique identifier (ID) for the Protection object to remove the health check association from.
[REQUIRED]
The Amazon Resource Name (ARN) of the health check that is associated with the protection.
dict
Response Syntax
{}
Response Structure
Exceptions
Authorizes the Shield Response Team (SRT) to use email and phone to notify contacts about escalations to the SRT and to initiate proactive customer support.
See also: AWS API Documentation
Request Syntax
response = client.enable_proactive_engagement()
{}
Response Structure
Exceptions
Create a paginator for an operation.
Returns the SubscriptionState , either Active or Inactive .
See also: AWS API Documentation
Request Syntax
response = client.get_subscription_state()
{
'SubscriptionState': 'ACTIVE'|'INACTIVE'
}
Response Structure
The status of the subscription.
Exceptions
Returns an object that can wait for some condition.
Returns all ongoing DDoS attacks or all DDoS attacks during a specified time period.
See also: AWS API Documentation
Request Syntax
response = client.list_attacks(
ResourceArns=[
'string',
],
StartTime={
'FromInclusive': datetime(2015, 1, 1),
'ToExclusive': datetime(2015, 1, 1)
},
EndTime={
'FromInclusive': datetime(2015, 1, 1),
'ToExclusive': datetime(2015, 1, 1)
},
NextToken='string',
MaxResults=123
)
The ARN (Amazon Resource Name) of the resource that was attacked. If this is left blank, all applicable resources for this account will be included.
The start of the time period for the attacks. This is a timestamp type. The sample request above indicates a number type because the default used by WAF is Unix time in seconds. However any valid timestamp format is allowed.
The end of the time period for the attacks. This is a timestamp type. The sample request above indicates a number type because the default used by WAF is Unix time in seconds. However any valid timestamp format is allowed.
The maximum number of AttackSummary objects to return. If you leave this blank, Shield Advanced returns the first 20 results.
This is a maximum value. Shield Advanced might return the results in smaller batches. That is, the number of objects returned could be less than MaxResults , even if there are still more objects yet to return. If there are more objects to return, Shield Advanced returns a value in NextToken that you can use in your next request, to get the next batch of objects.
dict
Response Syntax
{
'AttackSummaries': [
{
'AttackId': 'string',
'ResourceArn': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'AttackVectors': [
{
'VectorType': 'string'
},
]
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
AttackSummaries (list) --
The attack information for the specified time range.
(dict) --
Summarizes all DDoS attacks for a specified time period.
AttackId (string) --
The unique identifier (ID) of the attack.
ResourceArn (string) --
The ARN (Amazon Resource Name) of the resource that was attacked.
StartTime (datetime) --
The start time of the attack, in Unix time in seconds. For more information see timestamp .
EndTime (datetime) --
The end time of the attack, in Unix time in seconds. For more information see timestamp .
AttackVectors (list) --
The list of attacks for a specified time period.
(dict) --
Describes the attack.
VectorType (string) --
The attack type. Valid values:
NextToken (string) --
The token returned by a previous call to indicate that there is more data available. If not null, more results are available. Pass this value for the NextMarker parameter in a subsequent call to ListAttacks to retrieve the next set of items.
Shield Advanced might return the list of AttackSummary objects in batches smaller than the number specified by MaxResults. If there are more attack summary objects to return, Shield Advanced will always also return a NextToken .
Exceptions
Retrieves the ProtectionGroup objects for the account.
See also: AWS API Documentation
Request Syntax
response = client.list_protection_groups(
NextToken='string',
MaxResults=123
)
The maximum number of ProtectionGroup objects to return. If you leave this blank, Shield Advanced returns the first 20 results.
This is a maximum value. Shield Advanced might return the results in smaller batches. That is, the number of objects returned could be less than MaxResults , even if there are still more objects yet to return. If there are more objects to return, Shield Advanced returns a value in NextToken that you can use in your next request, to get the next batch of objects.
dict
Response Syntax
{
'ProtectionGroups': [
{
'ProtectionGroupId': 'string',
'Aggregation': 'SUM'|'MEAN'|'MAX',
'Pattern': 'ALL'|'ARBITRARY'|'BY_RESOURCE_TYPE',
'ResourceType': 'CLOUDFRONT_DISTRIBUTION'|'ROUTE_53_HOSTED_ZONE'|'ELASTIC_IP_ALLOCATION'|'CLASSIC_LOAD_BALANCER'|'APPLICATION_LOAD_BALANCER'|'GLOBAL_ACCELERATOR',
'Members': [
'string',
],
'ProtectionGroupArn': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
ProtectionGroups (list) --
(dict) --
A grouping of protected resources that you and Shield Advanced can monitor as a collective. This resource grouping improves the accuracy of detection and reduces false positives.
ProtectionGroupId (string) --
The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.
Aggregation (string) --
Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.
Pattern (string) --
The criteria to use to choose the protected resources for inclusion in the group. You can include all resources that have protections, provide a list of resource Amazon Resource Names (ARNs), or include all resources of a specified resource type.
ResourceType (string) --
The resource type to include in the protection group. All protected resources of this type are included in the protection group. You must set this when you set Pattern to BY_RESOURCE_TYPE and you must not set it for any other Pattern setting.
Members (list) --
The Amazon Resource Names (ARNs) of the resources to include in the protection group. You must set this when you set Pattern to ARBITRARY and you must not set it for any other Pattern setting.
ProtectionGroupArn (string) --
The ARN (Amazon Resource Name) of the protection group.
NextToken (string) --
If you specify a value for MaxResults and you have more protection groups than the value of MaxResults, Shield Advanced returns this token that you can use in your next request, to get the next batch of objects.
Exceptions
Lists all Protection objects for the account.
See also: AWS API Documentation
Request Syntax
response = client.list_protections(
NextToken='string',
MaxResults=123
)
The maximum number of Protection objects to return. If you leave this blank, Shield Advanced returns the first 20 results.
This is a maximum value. Shield Advanced might return the results in smaller batches. That is, the number of objects returned could be less than MaxResults , even if there are still more objects yet to return. If there are more objects to return, Shield Advanced returns a value in NextToken that you can use in your next request, to get the next batch of objects.
dict
Response Syntax
{
'Protections': [
{
'Id': 'string',
'Name': 'string',
'ResourceArn': 'string',
'HealthCheckIds': [
'string',
],
'ProtectionArn': 'string'
},
],
'NextToken': 'string'
}
Response Structure
(dict) --
Protections (list) --
The array of enabled Protection objects.
(dict) --
An object that represents a resource that is under DDoS protection.
Id (string) --
The unique identifier (ID) of the protection.
Name (string) --
The name of the protection. For example, My CloudFront distributions .
ResourceArn (string) --
The ARN (Amazon Resource Name) of the Amazon Web Services resource that is protected.
HealthCheckIds (list) --
The unique identifier (ID) for the Route 53 health check that's associated with the protection.
ProtectionArn (string) --
The ARN (Amazon Resource Name) of the protection.
NextToken (string) --
If you specify a value for MaxResults and you have more Protections than the value of MaxResults, Shield Advanced returns a NextToken value in the response that allows you to list another group of Protections. For the second and subsequent ListProtections requests, specify the value of NextToken from the previous response to get information about another batch of Protections.
Shield Advanced might return the list of Protection objects in batches smaller than the number specified by MaxResults. If there are more Protection objects to return, Shield Advanced will always also return a NextToken .
Exceptions
Retrieves the resources that are included in the protection group.
See also: AWS API Documentation
Request Syntax
response = client.list_resources_in_protection_group(
ProtectionGroupId='string',
NextToken='string',
MaxResults=123
)
[REQUIRED]
The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.
The maximum number of resource ARN objects to return. If you leave this blank, Shield Advanced returns the first 20 results.
This is a maximum value. Shield Advanced might return the results in smaller batches. That is, the number of objects returned could be less than MaxResults , even if there are still more objects yet to return. If there are more objects to return, Shield Advanced returns a value in NextToken that you can use in your next request, to get the next batch of objects.
dict
Response Syntax
{
'ResourceArns': [
'string',
],
'NextToken': 'string'
}
Response Structure
(dict) --
ResourceArns (list) --
The Amazon Resource Names (ARNs) of the resources that are included in the protection group.
NextToken (string) --
If you specify a value for MaxResults and you have more resources in the protection group than the value of MaxResults, Shield Advanced returns this token that you can use in your next request, to get the next batch of objects.
Exceptions
Gets information about Amazon Web Services tags for a specified Amazon Resource Name (ARN) in Shield.
See also: AWS API Documentation
Request Syntax
response = client.list_tags_for_resource(
ResourceARN='string'
)
[REQUIRED]
The Amazon Resource Name (ARN) of the resource to get tags for.
{
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
Response Structure
A list of tag key and value pairs associated with the specified resource.
A tag associated with an Amazon Web Services resource. Tags are key:value pairs that you can use to categorize and manage your resources, for purposes like billing or other management. Typically, the tag key represents a category, such as "environment", and the tag value represents a specific value within that category, such as "test," "development," or "production". Or you might set the tag key to "customer" and the value to the customer name or ID. You can specify one or more tags to add to each Amazon Web Services resource, up to 50 tags for a resource.
Part of the key:value pair that defines a tag. You can use a tag key to describe a category of information, such as "customer." Tag keys are case-sensitive.
Part of the key:value pair that defines a tag. You can use a tag value to describe a specific value within a category, such as "companyA" or "companyB." Tag values are case-sensitive.
Exceptions
Adds or updates tags for a resource in Shield.
See also: AWS API Documentation
Request Syntax
response = client.tag_resource(
ResourceARN='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
[REQUIRED]
The Amazon Resource Name (ARN) of the resource that you want to add or update tags for.
[REQUIRED]
The tags that you want to modify or add to the resource.
A tag associated with an Amazon Web Services resource. Tags are key:value pairs that you can use to categorize and manage your resources, for purposes like billing or other management. Typically, the tag key represents a category, such as "environment", and the tag value represents a specific value within that category, such as "test," "development," or "production". Or you might set the tag key to "customer" and the value to the customer name or ID. You can specify one or more tags to add to each Amazon Web Services resource, up to 50 tags for a resource.
Part of the key:value pair that defines a tag. You can use a tag key to describe a category of information, such as "customer." Tag keys are case-sensitive.
Part of the key:value pair that defines a tag. You can use a tag value to describe a specific value within a category, such as "companyA" or "companyB." Tag values are case-sensitive.
dict
Response Syntax
{}
Response Structure
Exceptions
Removes tags from a resource in Shield.
See also: AWS API Documentation
Request Syntax
response = client.untag_resource(
ResourceARN='string',
TagKeys=[
'string',
]
)
[REQUIRED]
The Amazon Resource Name (ARN) of the resource that you want to remove tags from.
[REQUIRED]
The tag key for each tag that you want to remove from the resource.
dict
Response Syntax
{}
Response Structure
Exceptions
Updates the details of the list of email addresses and phone numbers that the Shield Response Team (SRT) can use to contact you if you have proactive engagement enabled, for escalations to the SRT and to initiate proactive customer support.
See also: AWS API Documentation
Request Syntax
response = client.update_emergency_contact_settings(
EmergencyContactList=[
{
'EmailAddress': 'string',
'PhoneNumber': 'string',
'ContactNotes': 'string'
},
]
)
A list of email addresses and phone numbers that the Shield Response Team (SRT) can use to contact you if you have proactive engagement enabled, for escalations to the SRT and to initiate proactive customer support.
If you have proactive engagement enabled, the contact list must include at least one phone number.
Contact information that the SRT can use to contact you if you have proactive engagement enabled, for escalations to the SRT and to initiate proactive customer support.
The email address for the contact.
The phone number for the contact.
Additional notes regarding the contact.
{}
Response Structure
Exceptions
Updates an existing protection group. A protection group is a grouping of protected resources so they can be handled as a collective. This resource grouping improves the accuracy of detection and reduces false positives.
See also: AWS API Documentation
Request Syntax
response = client.update_protection_group(
ProtectionGroupId='string',
Aggregation='SUM'|'MEAN'|'MAX',
Pattern='ALL'|'ARBITRARY'|'BY_RESOURCE_TYPE',
ResourceType='CLOUDFRONT_DISTRIBUTION'|'ROUTE_53_HOSTED_ZONE'|'ELASTIC_IP_ALLOCATION'|'CLASSIC_LOAD_BALANCER'|'APPLICATION_LOAD_BALANCER'|'GLOBAL_ACCELERATOR',
Members=[
'string',
]
)
[REQUIRED]
The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.
[REQUIRED]
Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.
[REQUIRED]
The criteria to use to choose the protected resources for inclusion in the group. You can include all resources that have protections, provide a list of resource Amazon Resource Names (ARNs), or include all resources of a specified resource type.
The Amazon Resource Names (ARNs) of the resources to include in the protection group. You must set this when you set Pattern to ARBITRARY and you must not set it for any other Pattern setting.
dict
Response Syntax
{}
Response Structure
Exceptions
Updates the details of an existing subscription. Only enter values for parameters you want to change. Empty parameters are not updated.
See also: AWS API Documentation
Request Syntax
response = client.update_subscription(
AutoRenew='ENABLED'|'DISABLED'
)
{}
Response Structure
Exceptions
The available paginators are:
paginator = client.get_paginator('list_attacks')
Creates an iterator that will paginate through responses from Shield.Client.list_attacks().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
ResourceArns=[
'string',
],
StartTime={
'FromInclusive': datetime(2015, 1, 1),
'ToExclusive': datetime(2015, 1, 1)
},
EndTime={
'FromInclusive': datetime(2015, 1, 1),
'ToExclusive': datetime(2015, 1, 1)
},
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
The ARN (Amazon Resource Name) of the resource that was attacked. If this is left blank, all applicable resources for this account will be included.
The start of the time period for the attacks. This is a timestamp type. The sample request above indicates a number type because the default used by WAF is Unix time in seconds. However any valid timestamp format is allowed.
The end of the time period for the attacks. This is a timestamp type. The sample request above indicates a number type because the default used by WAF is Unix time in seconds. However any valid timestamp format is allowed.
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
dict
Response Syntax
{
'AttackSummaries': [
{
'AttackId': 'string',
'ResourceArn': 'string',
'StartTime': datetime(2015, 1, 1),
'EndTime': datetime(2015, 1, 1),
'AttackVectors': [
{
'VectorType': 'string'
},
]
},
],
}
Response Structure
(dict) --
AttackSummaries (list) --
The attack information for the specified time range.
(dict) --
Summarizes all DDoS attacks for a specified time period.
AttackId (string) --
The unique identifier (ID) of the attack.
ResourceArn (string) --
The ARN (Amazon Resource Name) of the resource that was attacked.
StartTime (datetime) --
The start time of the attack, in Unix time in seconds. For more information see timestamp .
EndTime (datetime) --
The end time of the attack, in Unix time in seconds. For more information see timestamp .
AttackVectors (list) --
The list of attacks for a specified time period.
(dict) --
Describes the attack.
VectorType (string) --
The attack type. Valid values:
paginator = client.get_paginator('list_protections')
Creates an iterator that will paginate through responses from Shield.Client.list_protections().
See also: AWS API Documentation
Request Syntax
response_iterator = paginator.paginate(
PaginationConfig={
'MaxItems': 123,
'PageSize': 123,
'StartingToken': 'string'
}
)
A dictionary that provides parameters to control pagination.
The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.
The size of each page.
A token to specify where to start paginating. This is the NextToken from a previous response.
{
'Protections': [
{
'Id': 'string',
'Name': 'string',
'ResourceArn': 'string',
'HealthCheckIds': [
'string',
],
'ProtectionArn': 'string'
},
],
}
Response Structure
The array of enabled Protection objects.
An object that represents a resource that is under DDoS protection.
The unique identifier (ID) of the protection.
The name of the protection. For example, My CloudFront distributions .
The ARN (Amazon Resource Name) of the Amazon Web Services resource that is protected.
The unique identifier (ID) for the Route 53 health check that's associated with the protection.
The ARN (Amazon Resource Name) of the protection.