Table of Contents
A low-level client representing AWS Shield:
client = session.create_client('shield')
These are the available methods:
Authorizes the DDoS Response team (DRT) to access the specified Amazon S3 bucket containing your flow logs. You can associate up to 10 Amazon S3 buckets with your subscription.
To use the services of the DRT 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 your flow logs.
{}
Response Structure
Authorizes the DDoS Response team (DRT), using the specified role, to access your AWS account to assist with DDoS attack mitigation during potential attacks. This enables the DRT to inspect your AWS WAF configuration and create or update AWS 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 DRT will have access only to your AWS WAF and Shield resources. By submitting this request, you authorize the DRT to inspect your AWS WAF and Shield configuration and create and update AWS WAF rules and web ACLs on your behalf. The DRT 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 AWS Service .
To use the services of the DRT 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 DRT will use to access your AWS 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
Check if an operation can be paginated.
Enables AWS Shield Advanced for a specific AWS resource. The resource can be an Amazon CloudFront distribution, Elastic Load Balancing load balancer, 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 AWS WAF console . For more information see Getting Started with AWS Shield Advanced and Add AWS Shield Advanced Protection to more AWS Resources .
See also: AWS API Documentation
Request Syntax
response = client.create_protection(
Name='string',
ResourceArn='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:
dict
Response Syntax
{
'ProtectionId': 'string'
}
Response Structure
(dict) --
ProtectionId (string) --
The unique identifier (ID) for the Protection object that is created.
Activates AWS Shield Advanced for an account.
As part of this request you can specify EmergencySettings that automaticaly grant the DDoS response team (DRT) needed permissions to assist you during a suspected DDoS attack. For more information see Authorize the DDoS Response Team to Create Rules and Web ACLs on Your Behalf .
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
Deletes an AWS 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
Removes AWS Shield Advanced from an account. AWS 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
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',
'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 AttackProperty objects.
Details of the described attack.
The type of DDoS event that was observed. NETWORK indicates layer 3 and layer 4 events and APPLICATION indicates layer 7 events.
Defines the DDoS attack property information that is provided.
The array of Contributor objects that includes the top five contributors to an attack.
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 of the Value of the contributions.
The total contributions made to this attack by all contributors, not just the five listed in the TopContributors list.
List of mitigation actions taken for the attack.
The mitigation applied to a DDoS attack.
The name of the mitigation taken for this attack.
Returns the current role and list of Amazon S3 log buckets used by the DDoS Response team (DRT) to access your AWS 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 DRT used to access your AWS account.
The list of Amazon S3 buckets accessed by the DRT.
Lists the email addresses that the DRT can use to contact you during a suspected attack.
See also: AWS API Documentation
Request Syntax
response = client.describe_emergency_contact_settings()
{
'EmergencyContactList': [
{
'EmailAddress': 'string'
},
]
}
Response Structure
A list of email addresses that the DRT can use to contact you during a suspected attack.
Contact information that the DRT can use to contact you during a suspected attack.
An email address that the DRT can use to contact you during a suspected attack.
Lists the details of a Protection object.
See also: AWS API Documentation
Request Syntax
response = client.describe_protection(
ProtectionId='string'
)
[REQUIRED]
The unique identifier (ID) for the Protection object that is described.
{
'Protection': {
'Id': 'string',
'Name': 'string',
'ResourceArn': 'string'
}
}
Response Structure
The Protection object that is described.
The unique identifier (ID) of the protection.
The friendly name of the protection. For example, My CloudFront distributions .
The ARN (Amazon Resource Name) of the AWS resource that is protected.
Provides details about the AWS 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
},
]
}
}
Response Structure
The AWS 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 AWS 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 .
Removes the DDoS Response team's (DRT) access to the specified Amazon S3 bucket containing your flow logs.
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 DRT 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 your flow logs.
{}
Response Structure
Removes the DDoS Response team's (DRT) access to your AWS 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 DRT 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
Generate a presigned url given a client, its method, and arguments
The presigned url
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.
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.
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.
Lists all Protection objects for the account.
See also: AWS API Documentation
Request Syntax
response = client.list_protections(
NextToken='string',
MaxResults=123
)
dict
Response Syntax
{
'Protections': [
{
'Id': 'string',
'Name': 'string',
'ResourceArn': '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 friendly name of the protection. For example, My CloudFront distributions .
ResourceArn (string) --
The ARN (Amazon Resource Name) of the AWS resource that is protected.
NextToken (string) --
If you specify a value for MaxResults and you have more Protections than the value of MaxResults, AWS 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.
Updates the details of the list of email addresses that the DRT can use to contact you during a suspected attack.
See also: AWS API Documentation
Request Syntax
response = client.update_emergency_contact_settings(
EmergencyContactList=[
{
'EmailAddress': 'string'
},
]
)
A list of email addresses that the DRT can use to contact you during a suspected attack.
Contact information that the DRT can use to contact you during a suspected attack.
An email address that the DRT can use to contact you during a suspected attack.
{}
Response Structure
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
The available paginators are:
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'
},
],
}
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 friendly name of the protection. For example, My CloudFront distributions .
The ARN (Amazon Resource Name) of the AWS resource that is protected.