You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::Shield::Client

Inherits:
Seahorse::Client::Base show all
Defined in:
(unknown)

Overview

An API client for AWS Shield. To construct a client, you need to configure a :region and :credentials.

shield = Aws::Shield::Client.new(
  region: region_name,
  credentials: credentials,
  # ...
)

See #initialize for a full list of supported configuration options.

Region

You can configure a default region in the following locations:

  • ENV['AWS_REGION']
  • Aws.config[:region]

Go here for a list of supported regions.

Credentials

Default credentials are loaded automatically from the following locations:

  • ENV['AWS_ACCESS_KEY_ID'] and ENV['AWS_SECRET_ACCESS_KEY']
  • Aws.config[:credentials]
  • The shared credentials ini file at ~/.aws/credentials (more information)
  • From an instance profile when running on EC2

You can also construct a credentials object from one of the following classes:

Alternatively, you configure credentials with :access_key_id and :secret_access_key:

# load credentials from disk
creds = YAML.load(File.read('/path/to/secrets'))

Aws::Shield::Client.new(
  access_key_id: creds['access_key_id'],
  secret_access_key: creds['secret_access_key']
)

Always load your credentials from outside your application. Avoid configuring credentials statically and never commit them to source control.

Instance Attribute Summary

Attributes inherited from Seahorse::Client::Base

#config, #handlers

Constructor collapse

API Operations collapse

Instance Method Summary collapse

Methods inherited from Seahorse::Client::Base

add_plugin, api, #build_request, clear_plugins, define, new, #operation, #operation_names, plugins, remove_plugin, set_api, set_plugins

Methods included from Seahorse::Client::HandlerBuilder

#handle, #handle_request, #handle_response

Constructor Details

#initialize(options = {}) ⇒ Aws::Shield::Client

Constructs an API client.

Options Hash (options):

  • :access_key_id (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :active_endpoint_cache (Boolean)

    When set to true, a thread polling for endpoints will be running in the background every 60 secs (default). Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :convert_params (Boolean) — default: true

    When true, an attempt is made to coerce request parameters into the required types. See Plugins::ParamConverter for more details.

  • :credentials (required, Credentials)

    Your AWS credentials. The following locations will be searched in order for credentials:

    • :access_key_id, :secret_access_key, and :session_token options
    • ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']
    • HOME/.aws/credentials shared credentials file
    • EC2 instance profile credentials See Plugins::RequestSigner for more details.
  • :disable_host_prefix_injection (Boolean)

    Set to true to disable SDK automatically adding host prefix to default service endpoint when available. See Plugins::EndpointPattern for more details.

  • :endpoint (String)

    A default endpoint is constructed from the :region. See Plugins::RegionalEndpoint for more details.

  • :endpoint_cache_max_entries (Integer)

    Used for the maximum size limit of the LRU cache storing endpoints data for endpoint discovery enabled operations. Defaults to 1000. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_max_threads (Integer)

    Used for the maximum threads in use for polling endpoints to be cached, defaults to 10. See Plugins::EndpointDiscovery for more details.

  • :endpoint_cache_poll_interval (Integer)

    When :endpoint_discovery and :active_endpoint_cache is enabled, Use this option to config the time interval in seconds for making requests fetching endpoints information. Defaults to 60 sec. See Plugins::EndpointDiscovery for more details.

  • :endpoint_discovery (Boolean)

    When set to true, endpoint discovery will be enabled for operations when available. Defaults to false. See Plugins::EndpointDiscovery for more details.

  • :http_continue_timeout (Float) — default: 1

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_idle_timeout (Integer) — default: 5

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_open_timeout (Integer) — default: 15

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_proxy (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_read_timeout (Integer) — default: 60

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :http_wire_trace (Boolean) — default: false

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :log_level (Symbol) — default: :info

    The log level to send messages to the logger at. See Plugins::Logging for more details.

  • :log_formatter (Logging::LogFormatter)

    The log formatter. Defaults to Seahorse::Client::Logging::Formatter.default. See Plugins::Logging for more details.

  • :logger (Logger) — default: nil

    The Logger instance to send log messages to. If this option is not set, logging will be disabled. See Plugins::Logging for more details.

  • :profile (String)

    Used when loading credentials from the shared credentials file at HOME/.aws/credentials. When not specified, 'default' is used. See Plugins::RequestSigner for more details.

  • :raise_response_errors (Boolean) — default: true

    When true, response errors are raised. See Seahorse::Client::Plugins::RaiseResponseErrors for more details.

  • :region (required, String)

    The AWS region to connect to. The region is used to construct the client endpoint. Defaults to ENV['AWS_REGION']. Also checks AMAZON_REGION and AWS_DEFAULT_REGION. See Plugins::RegionalEndpoint for more details.

  • :retry_limit (Integer) — default: 3

    The maximum number of times to retry failed requests. Only ~ 500 level server errors and certain ~ 400 level client errors are retried. Generally, these are throttling errors, data checksum errors, networking errors, timeout errors and auth errors from expired credentials. See Plugins::RetryErrors for more details.

  • :secret_access_key (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :session_token (String)

    Used to set credentials statically. See Plugins::RequestSigner for more details.

  • :simple_json (Boolean) — default: false

    Disables request parameter conversion, validation, and formatting. Also disable response data type conversions. This option is useful when you want to ensure the highest level of performance by avoiding overhead of walking request parameters and response data structures.

    When :simple_json is enabled, the request parameters hash must be formatted exactly as the DynamoDB API expects. See Plugins::Protocols::JsonRpc for more details.

  • :ssl_ca_bundle (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_directory (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_ca_store (String)

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :ssl_verify_peer (Boolean) — default: true

    See Seahorse::Client::Plugins::NetHttp for more details.

  • :stub_responses (Boolean) — default: false

    Causes the client to return stubbed responses. By default fake responses are generated and returned. You can specify the response data to return or errors to raise by calling ClientStubs#stub_responses. See ClientStubs for more information.

    Please note When response stubbing is enabled, no HTTP requests are made, and retries are disabled. See Plugins::StubResponses for more details.

  • :validate_params (Boolean) — default: true

    When true, request parameters are validated before sending the request. See Plugins::ParamValidator for more details.

Instance Method Details

#associate_drt_log_bucket(options = {}) ⇒ Struct

Authorizes the DDoS Response Team (DRT) to access the specified Amazon S3 bucket containing your AWS WAF 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.

Examples:

Request syntax with placeholder values


resp = client.associate_drt_log_bucket({
  log_bucket: "LogBucket", # required
})

Options Hash (options):

  • :log_bucket (required, String)

    The Amazon S3 bucket that contains your AWS WAF logs.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#associate_drt_role(options = {}) ⇒ Struct

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. 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.

Examples:

Request syntax with placeholder values


resp = client.associate_drt_role({
  role_arn: "RoleArn", # required
})

Options Hash (options):

  • :role_arn (required, String)

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#associate_health_check(options = {}) ⇒ Struct

Adds health-based detection to the Shield Advanced protection for a resource. Shield Advanced health-based detection uses the health of your AWS 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 AWS WAF and AWS Shield Developer Guide.

Examples:

Request syntax with placeholder values


resp = client.associate_health_check({
  protection_id: "ProtectionId", # required
  health_check_arn: "HealthCheckArn", # required
})

Options Hash (options):

  • :protection_id (required, String)

    The unique identifier (ID) for the Protection object to add the health check association to.

  • :health_check_arn (required, String)

    The Amazon Resource Name (ARN) of the health check to associate with the protection.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#associate_proactive_engagement_details(options = {}) ⇒ Struct

Initializes proactive engagement and sets the list of contacts for the DDoS Response Team (DRT) 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.

This call defines the list of email addresses and phone numbers that the DDoS Response Team (DRT) can use to contact you for escalations to the DRT 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.

Examples:

Request syntax with placeholder values


resp = client.associate_proactive_engagement_details({
  emergency_contact_list: [ # required
    {
      email_address: "EmailAddress", # required
      phone_number: "PhoneNumber",
      contact_notes: "ContactNotes",
    },
  ],
})

Options Hash (options):

  • :emergency_contact_list (required, Array<Types::EmergencyContact>)

    A list of email addresses and phone numbers that the DDoS Response Team (DRT) can use to contact you for escalations to the DRT and to initiate proactive customer support.

    To enable proactive engagement, the contact list must include at least one phone number.

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#create_protection(options = {}) ⇒ Types::CreateProtectionResponse

Enables AWS Shield Advanced for a specific AWS resource. The resource can be an Amazon CloudFront distribution, Elastic Load Balancing load balancer, AWS 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 AWS WAF console. For more information see Getting Started with AWS Shield Advanced and Add AWS Shield Advanced Protection to more AWS Resources.

Examples:

Request syntax with placeholder values


resp = client.create_protection({
  name: "ProtectionName", # required
  resource_arn: "ResourceArn", # required
})

Response structure


resp.protection_id #=> String

Options Hash (options):

  • :name (required, String)

    Friendly name for the Protection you are creating.

  • :resource_arn (required, String)

    The ARN (Amazon Resource Name) of the resource to be protected.

    The ARN should be in one of the following formats:

    • For an Application Load Balancer: arn:aws:elasticloadbalancing:region:account-id:loadbalancer/app/load-balancer-name/load-balancer-id

    • For an Elastic Load Balancer (Classic Load Balancer): arn:aws:elasticloadbalancing:region:account-id:loadbalancer/load-balancer-name

    • For an AWS CloudFront distribution: arn:aws:cloudfront::account-id:distribution/distribution-id

    • For an AWS Global Accelerator accelerator: arn:aws:globalaccelerator::account-id:accelerator/accelerator-id

    • For Amazon Route 53: arn:aws:route53:::hostedzone/hosted-zone-id

    • For an Elastic IP address: arn:aws:ec2:region:account-id:eip-allocation/allocation-id

Returns:

See Also:

#create_protection_group(options = {}) ⇒ Struct

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.

Examples:

Request syntax with placeholder values


resp = client.create_protection_group({
  protection_group_id: "ProtectionGroupId", # required
  aggregation: "SUM", # required, accepts SUM, MEAN, MAX
  pattern: "ALL", # required, accepts ALL, ARBITRARY, BY_RESOURCE_TYPE
  resource_type: "CLOUDFRONT_DISTRIBUTION", # accepts CLOUDFRONT_DISTRIBUTION, ROUTE_53_HOSTED_ZONE, ELASTIC_IP_ALLOCATION, CLASSIC_LOAD_BALANCER, APPLICATION_LOAD_BALANCER, GLOBAL_ACCELERATOR
  members: ["ResourceArn"],
})

Options Hash (options):

  • :protection_group_id (required, 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 (required, String)

    Defines how AWS Shield combines resource data for the group in order to detect, mitigate, and report events.

    • Sum - Use the total traffic across the group. This is a good choice for most cases. Examples include Elastic IP addresses for EC2 instances that scale manually or automatically.

    • Mean - Use the average of the traffic across the group. This is a good choice for resources that share traffic uniformly. Examples include accelerators and load balancers.

    • Max - Use the highest traffic from each resource. This is useful for resources that don\'t share traffic and for resources that share that traffic in a non-uniform way. Examples include CloudFront distributions and origin resources for CloudFront distributions.

  • :pattern (required, 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.

  • :resource_type (String)

    The resource type to include in the protection group. All protected resources of this type are included in the protection group. Newly protected resources of this type are automatically added to the 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 (Array<String>)

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#create_subscription(options = {}) ⇒ Struct

Activates AWS 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.

Examples:

Request syntax with placeholder values


resp = client.create_subscription()

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_protection(options = {}) ⇒ Struct

Deletes an AWS Shield Advanced Protection.

Examples:

Request syntax with placeholder values


resp = client.delete_protection({
  protection_id: "ProtectionId", # required
})

Options Hash (options):

  • :protection_id (required, String)

    The unique identifier (ID) for the Protection object to be deleted.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_protection_group(options = {}) ⇒ Struct

Removes the specified protection group.

Examples:

Request syntax with placeholder values


resp = client.delete_protection_group({
  protection_group_id: "ProtectionGroupId", # required
})

Options Hash (options):

  • :protection_group_id (required, 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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#delete_subscription(options = {}) ⇒ Struct

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.

Examples:

Request syntax with placeholder values


resp = client.delete_subscription()

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#describe_attack(options = {}) ⇒ Types::DescribeAttackResponse

Describes the details of a DDoS attack.

Examples:

Request syntax with placeholder values


resp = client.describe_attack({
  attack_id: "AttackId", # required
})

Response structure


resp.attack.attack_id #=> String
resp.attack.resource_arn #=> String
resp.attack.sub_resources #=> Array
resp.attack.sub_resources[0].type #=> String, one of "IP", "URL"
resp.attack.sub_resources[0].id #=> String
resp.attack.sub_resources[0].attack_vectors #=> Array
resp.attack.sub_resources[0].attack_vectors[0].vector_type #=> String
resp.attack.sub_resources[0].attack_vectors[0].vector_counters #=> Array
resp.attack.sub_resources[0].attack_vectors[0].vector_counters[0].name #=> String
resp.attack.sub_resources[0].attack_vectors[0].vector_counters[0].max #=> Float
resp.attack.sub_resources[0].attack_vectors[0].vector_counters[0].average #=> Float
resp.attack.sub_resources[0].attack_vectors[0].vector_counters[0].sum #=> Float
resp.attack.sub_resources[0].attack_vectors[0].vector_counters[0].n #=> Integer
resp.attack.sub_resources[0].attack_vectors[0].vector_counters[0].unit #=> String
resp.attack.sub_resources[0].counters #=> Array
resp.attack.sub_resources[0].counters[0].name #=> String
resp.attack.sub_resources[0].counters[0].max #=> Float
resp.attack.sub_resources[0].counters[0].average #=> Float
resp.attack.sub_resources[0].counters[0].sum #=> Float
resp.attack.sub_resources[0].counters[0].n #=> Integer
resp.attack.sub_resources[0].counters[0].unit #=> String
resp.attack.start_time #=> Time
resp.attack.end_time #=> Time
resp.attack.attack_counters #=> Array
resp.attack.attack_counters[0].name #=> String
resp.attack.attack_counters[0].max #=> Float
resp.attack.attack_counters[0].average #=> Float
resp.attack.attack_counters[0].sum #=> Float
resp.attack.attack_counters[0].n #=> Integer
resp.attack.attack_counters[0].unit #=> String
resp.attack.attack_properties #=> Array
resp.attack.attack_properties[0].attack_layer #=> String, one of "NETWORK", "APPLICATION"
resp.attack.attack_properties[0].attack_property_identifier #=> String, one of "DESTINATION_URL", "REFERRER", "SOURCE_ASN", "SOURCE_COUNTRY", "SOURCE_IP_ADDRESS", "SOURCE_USER_AGENT", "WORDPRESS_PINGBACK_REFLECTOR", "WORDPRESS_PINGBACK_SOURCE"
resp.attack.attack_properties[0].top_contributors #=> Array
resp.attack.attack_properties[0].top_contributors[0].name #=> String
resp.attack.attack_properties[0].top_contributors[0].value #=> Integer
resp.attack.attack_properties[0].unit #=> String, one of "BITS", "BYTES", "PACKETS", "REQUESTS"
resp.attack.attack_properties[0].total #=> Integer
resp.attack.mitigations #=> Array
resp.attack.mitigations[0].mitigation_name #=> String

Options Hash (options):

  • :attack_id (required, String)

    The unique identifier (ID) for the attack that to be described.

Returns:

See Also:

#describe_attack_statistics(options = {}) ⇒ Types::DescribeAttackStatisticsResponse

Provides information about the number and type of attacks AWS 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.

Examples:

Request syntax with placeholder values


resp = client.describe_attack_statistics()

Response structure


resp.time_range.from_inclusive #=> Time
resp.time_range.to_exclusive #=> Time
resp.data_items #=> Array
resp.data_items[0].attack_volume.bits_per_second.max #=> Float
resp.data_items[0].attack_volume.packets_per_second.max #=> Float
resp.data_items[0].attack_volume.requests_per_second.max #=> Float
resp.data_items[0].attack_count #=> Integer

Returns:

See Also:

#describe_drt_access(options = {}) ⇒ Types::DescribeDRTAccessResponse

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.

Examples:

Request syntax with placeholder values


resp = client.describe_drt_access()

Response structure


resp.role_arn #=> String
resp.log_bucket_list #=> Array
resp.log_bucket_list[0] #=> String

Returns:

See Also:

#describe_emergency_contact_settings(options = {}) ⇒ Types::DescribeEmergencyContactSettingsResponse

A list of email addresses and phone numbers that the DDoS Response Team (DRT) can use to contact you if you have proactive engagement enabled, for escalations to the DRT and to initiate proactive customer support.

Examples:

Request syntax with placeholder values


resp = client.describe_emergency_contact_settings()

Response structure


resp.emergency_contact_list #=> Array
resp.emergency_contact_list[0].email_address #=> String
resp.emergency_contact_list[0].phone_number #=> String
resp.emergency_contact_list[0].contact_notes #=> String

Returns:

See Also:

#describe_protection(options = {}) ⇒ Types::DescribeProtectionResponse

Lists the details of a Protection object.

Examples:

Request syntax with placeholder values


resp = client.describe_protection({
  protection_id: "ProtectionId",
  resource_arn: "ResourceArn",
})

Response structure


resp.protection.id #=> String
resp.protection.name #=> String
resp.protection.resource_arn #=> String
resp.protection.health_check_ids #=> Array
resp.protection.health_check_ids[0] #=> String

Options Hash (options):

  • :protection_id (String)

    The unique identifier (ID) for the Protection object that is described. When submitting the DescribeProtection request you must provide either the ResourceArn or the ProtectionID, but not both.

  • :resource_arn (String)

    The ARN (Amazon Resource Name) of the AWS resource for the Protection object that is described. When submitting the DescribeProtection request you must provide either the ResourceArn or the ProtectionID, but not both.

Returns:

See Also:

#describe_protection_group(options = {}) ⇒ Types::DescribeProtectionGroupResponse

Returns the specification for the specified protection group.

Examples:

Request syntax with placeholder values


resp = client.describe_protection_group({
  protection_group_id: "ProtectionGroupId", # required
})

Response structure


resp.protection_group.protection_group_id #=> String
resp.protection_group.aggregation #=> String, one of "SUM", "MEAN", "MAX"
resp.protection_group.pattern #=> String, one of "ALL", "ARBITRARY", "BY_RESOURCE_TYPE"
resp.protection_group.resource_type #=> String, one of "CLOUDFRONT_DISTRIBUTION", "ROUTE_53_HOSTED_ZONE", "ELASTIC_IP_ALLOCATION", "CLASSIC_LOAD_BALANCER", "APPLICATION_LOAD_BALANCER", "GLOBAL_ACCELERATOR"
resp.protection_group.members #=> Array
resp.protection_group.members[0] #=> String

Options Hash (options):

  • :protection_group_id (required, 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.

Returns:

See Also:

#describe_subscription(options = {}) ⇒ Types::DescribeSubscriptionResponse

Provides details about the AWS Shield Advanced subscription for an account.

Examples:

Request syntax with placeholder values


resp = client.describe_subscription()

Response structure


resp.subscription.start_time #=> Time
resp.subscription.end_time #=> Time
resp.subscription.time_commitment_in_seconds #=> Integer
resp.subscription.auto_renew #=> String, one of "ENABLED", "DISABLED"
resp.subscription.limits #=> Array
resp.subscription.limits[0].type #=> String
resp.subscription.limits[0].max #=> Integer
resp.subscription.proactive_engagement_status #=> String, one of "ENABLED", "DISABLED", "PENDING"
resp.subscription.subscription_limits.protection_limits.protected_resource_type_limits #=> Array
resp.subscription.subscription_limits.protection_limits.protected_resource_type_limits[0].type #=> String
resp.subscription.subscription_limits.protection_limits.protected_resource_type_limits[0].max #=> Integer
resp.subscription.subscription_limits.protection_group_limits.max_protection_groups #=> Integer
resp.subscription.subscription_limits.protection_group_limits.pattern_type_limits.arbitrary_pattern_limits.max_members #=> Integer

Returns:

See Also:

#disable_proactive_engagement(options = {}) ⇒ Struct

Removes authorization from the DDoS Response Team (DRT) to notify contacts about escalations to the DRT and to initiate proactive customer support.

Examples:

Request syntax with placeholder values


resp = client.disable_proactive_engagement()

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#disassociate_drt_log_bucket(options = {}) ⇒ Struct

Removes the DDoS Response Team's (DRT) access to the specified Amazon S3 bucket containing your AWS WAF 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.

Examples:

Request syntax with placeholder values


resp = client.disassociate_drt_log_bucket({
  log_bucket: "LogBucket", # required
})

Options Hash (options):

  • :log_bucket (required, String)

    The Amazon S3 bucket that contains your AWS WAF logs.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#disassociate_drt_role(options = {}) ⇒ Struct

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.

Examples:

Request syntax with placeholder values


resp = client.disassociate_drt_role()

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#disassociate_health_check(options = {}) ⇒ Struct

Removes health-based detection from the Shield Advanced protection for a resource. Shield Advanced health-based detection uses the health of your AWS 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 AWS WAF and AWS Shield Developer Guide.

Examples:

Request syntax with placeholder values


resp = client.disassociate_health_check({
  protection_id: "ProtectionId", # required
  health_check_arn: "HealthCheckArn", # required
})

Options Hash (options):

  • :protection_id (required, String)

    The unique identifier (ID) for the Protection object to remove the health check association from.

  • :health_check_arn (required, String)

    The Amazon Resource Name (ARN) of the health check that is associated with the protection.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#enable_proactive_engagement(options = {}) ⇒ Struct

Authorizes the DDoS Response Team (DRT) to use email and phone to notify contacts about escalations to the DRT and to initiate proactive customer support.

Examples:

Request syntax with placeholder values


resp = client.enable_proactive_engagement()

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#get_subscription_state(options = {}) ⇒ Types::GetSubscriptionStateResponse

Returns the SubscriptionState, either Active or Inactive.

Examples:

Request syntax with placeholder values


resp = client.get_subscription_state()

Response structure


resp.subscription_state #=> String, one of "ACTIVE", "INACTIVE"

Returns:

See Also:

#list_attacks(options = {}) ⇒ Types::ListAttacksResponse

Returns all ongoing DDoS attacks or all DDoS attacks during a specified time period.

Examples:

Request syntax with placeholder values


resp = client.list_attacks({
  resource_arns: ["ResourceArn"],
  start_time: {
    from_inclusive: Time.now,
    to_exclusive: Time.now,
  },
  end_time: {
    from_inclusive: Time.now,
    to_exclusive: Time.now,
  },
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.attack_summaries #=> Array
resp.attack_summaries[0].attack_id #=> String
resp.attack_summaries[0].resource_arn #=> String
resp.attack_summaries[0].start_time #=> Time
resp.attack_summaries[0].end_time #=> Time
resp.attack_summaries[0].attack_vectors #=> Array
resp.attack_summaries[0].attack_vectors[0].vector_type #=> String
resp.next_token #=> String

Options Hash (options):

  • :resource_arns (Array<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.

  • :start_time (Types::TimeRange)

    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.

  • :end_time (Types::TimeRange)

    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.

  • :next_token (String)

    The ListAttacksRequest.NextMarker value from a previous call to ListAttacksRequest. Pass null if this is the first call.

  • :max_results (Integer)

    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.

Returns:

See Also:

#list_protection_groups(options = {}) ⇒ Types::ListProtectionGroupsResponse

Retrieves the ProtectionGroup objects for the account.

Examples:

Request syntax with placeholder values


resp = client.list_protection_groups({
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.protection_groups #=> Array
resp.protection_groups[0].protection_group_id #=> String
resp.protection_groups[0].aggregation #=> String, one of "SUM", "MEAN", "MAX"
resp.protection_groups[0].pattern #=> String, one of "ALL", "ARBITRARY", "BY_RESOURCE_TYPE"
resp.protection_groups[0].resource_type #=> String, one of "CLOUDFRONT_DISTRIBUTION", "ROUTE_53_HOSTED_ZONE", "ELASTIC_IP_ALLOCATION", "CLASSIC_LOAD_BALANCER", "APPLICATION_LOAD_BALANCER", "GLOBAL_ACCELERATOR"
resp.protection_groups[0].members #=> Array
resp.protection_groups[0].members[0] #=> String
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    The next token value from a previous call to ListProtectionGroups. Pass null if this is the first call.

  • :max_results (Integer)

    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.

Returns:

See Also:

#list_protections(options = {}) ⇒ Types::ListProtectionsResponse

Lists all Protection objects for the account.

Examples:

Request syntax with placeholder values


resp = client.list_protections({
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.protections #=> Array
resp.protections[0].id #=> String
resp.protections[0].name #=> String
resp.protections[0].resource_arn #=> String
resp.protections[0].health_check_ids #=> Array
resp.protections[0].health_check_ids[0] #=> String
resp.next_token #=> String

Options Hash (options):

  • :next_token (String)

    The ListProtectionsRequest.NextToken value from a previous call to ListProtections. Pass null if this is the first call.

  • :max_results (Integer)

    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.

Returns:

See Also:

#list_resources_in_protection_group(options = {}) ⇒ Types::ListResourcesInProtectionGroupResponse

Retrieves the resources that are included in the protection group.

Examples:

Request syntax with placeholder values


resp = client.list_resources_in_protection_group({
  protection_group_id: "ProtectionGroupId", # required
  next_token: "Token",
  max_results: 1,
})

Response structure


resp.resource_arns #=> Array
resp.resource_arns[0] #=> String
resp.next_token #=> String

Options Hash (options):

  • :protection_group_id (required, 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.

  • :next_token (String)

    The next token value from a previous call to ListResourcesInProtectionGroup. Pass null if this is the first call.

  • :max_results (Integer)

    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.

Returns:

See Also:

#update_emergency_contact_settings(options = {}) ⇒ Struct

Updates the details of the list of email addresses and phone numbers that the DDoS Response Team (DRT) can use to contact you if you have proactive engagement enabled, for escalations to the DRT and to initiate proactive customer support.

Examples:

Request syntax with placeholder values


resp = client.update_emergency_contact_settings({
  emergency_contact_list: [
    {
      email_address: "EmailAddress", # required
      phone_number: "PhoneNumber",
      contact_notes: "ContactNotes",
    },
  ],
})

Options Hash (options):

  • :emergency_contact_list (Array<Types::EmergencyContact>)

    A list of email addresses and phone numbers that the DDoS Response Team (DRT) can use to contact you if you have proactive engagement enabled, for escalations to the DRT and to initiate proactive customer support.

    If you have proactive engagement enabled, the contact list must include at least one phone number.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#update_protection_group(options = {}) ⇒ Struct

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.

Examples:

Request syntax with placeholder values


resp = client.update_protection_group({
  protection_group_id: "ProtectionGroupId", # required
  aggregation: "SUM", # required, accepts SUM, MEAN, MAX
  pattern: "ALL", # required, accepts ALL, ARBITRARY, BY_RESOURCE_TYPE
  resource_type: "CLOUDFRONT_DISTRIBUTION", # accepts CLOUDFRONT_DISTRIBUTION, ROUTE_53_HOSTED_ZONE, ELASTIC_IP_ALLOCATION, CLASSIC_LOAD_BALANCER, APPLICATION_LOAD_BALANCER, GLOBAL_ACCELERATOR
  members: ["ResourceArn"],
})

Options Hash (options):

  • :protection_group_id (required, 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 (required, String)

    Defines how AWS Shield combines resource data for the group in order to detect, mitigate, and report events.

    • Sum - Use the total traffic across the group. This is a good choice for most cases. Examples include Elastic IP addresses for EC2 instances that scale manually or automatically.

    • Mean - Use the average of the traffic across the group. This is a good choice for resources that share traffic uniformly. Examples include accelerators and load balancers.

    • Max - Use the highest traffic from each resource. This is useful for resources that don\'t share traffic and for resources that share that traffic in a non-uniform way. Examples include CloudFront distributions and origin resources for CloudFront distributions.

  • :pattern (required, 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.

  • :resource_type (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 (Array<String>)

    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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#update_subscription(options = {}) ⇒ Struct

Updates the details of an existing subscription. Only enter values for parameters you want to change. Empty parameters are not updated.

Examples:

Request syntax with placeholder values


resp = client.update_subscription({
  auto_renew: "ENABLED", # accepts ENABLED, DISABLED
})

Options Hash (options):

  • :auto_renew (String)

    When you initally create a subscription, AutoRenew is set to ENABLED. If ENABLED, the subscription will be automatically renewed at the end of the existing subscription period. 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.

Returns:

  • (Struct)

    Returns an empty response.

See Also:

#wait_until(waiter_name, params = {}) {|waiter| ... } ⇒ Boolean

Waiters polls an API operation until a resource enters a desired state.

Basic Usage

Waiters will poll until they are succesful, they fail by entering a terminal state, or until a maximum number of attempts are made.

# polls in a loop, sleeping between attempts client.waiter_until(waiter_name, params)

Configuration

You can configure the maximum number of polling attempts, and the delay (in seconds) between each polling attempt. You configure waiters by passing a block to #wait_until:

# poll for ~25 seconds
client.wait_until(...) do |w|
  w.max_attempts = 5
  w.delay = 5
end

Callbacks

You can be notified before each polling attempt and before each delay. If you throw :success or :failure from these callbacks, it will terminate the waiter.

started_at = Time.now
client.wait_until(...) do |w|

  # disable max attempts
  w.max_attempts = nil

  # poll for 1 hour, instead of a number of attempts
  w.before_wait do |attempts, response|
    throw :failure if Time.now - started_at > 3600
  end

end

Handling Errors

When a waiter is successful, it returns true. When a waiter fails, it raises an error. All errors raised extend from Waiters::Errors::WaiterFailed.

begin
  client.wait_until(...)
rescue Aws::Waiters::Errors::WaiterFailed
  # resource did not enter the desired state in time
end

Parameters:

  • waiter_name (Symbol)

    The name of the waiter. See #waiter_names for a full list of supported waiters.

  • params (Hash) (defaults to: {})

    Additional request parameters. See the #waiter_names for a list of supported waiters and what request they call. The called request determines the list of accepted parameters.

Yield Parameters:

Returns:

  • (Boolean)

    Returns true if the waiter was successful.

Raises:

  • (Errors::FailureStateError)

    Raised when the waiter terminates because the waiter has entered a state that it will not transition out of, preventing success.

  • (Errors::TooManyAttemptsError)

    Raised when the configured maximum number of attempts have been made, and the waiter is not yet successful.

  • (Errors::UnexpectedError)

    Raised when an error is encounted while polling for a resource that is not expected.

  • (Errors::NoSuchWaiterError)

    Raised when you request to wait for an unknown state.

#waiter_namesArray<Symbol>

Returns the list of supported waiters. The following table lists the supported waiters and the client method they call:

Waiter NameClient MethodDefault Delay:Default Max Attempts:

Returns:

  • (Array<Symbol>)

    the list of supported waiters.