Skip to content

AwsShieldConfig

Bases: BaseModel, AwsTypesValidationMixin

Configuration model for AWS Shield Advanced DDoS protection setup.

Defines the structure and validation rules for AWS Shield Advanced protection configuration, providing enterprise-grade DDoS mitigation for CloudFront distributions and Route53 hosted zones. Enables advanced threat protection, 24/7 DDoS Response Team support, and cost protection against DDoS-related infrastructure scaling charges.

Source code in mare_aws_common_lib/models/aws_shield_config.py
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
class AwsShieldConfig(BaseModel, AwsTypesValidationMixin):
    """Configuration model for AWS Shield Advanced DDoS protection setup.

    Defines the structure and validation rules for AWS Shield Advanced protection
    configuration, providing enterprise-grade DDoS mitigation for CloudFront
    distributions and Route53 hosted zones. Enables advanced threat protection,
    24/7 DDoS Response Team support, and cost protection against DDoS-related
    infrastructure scaling charges.
    """

    model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)

    route53: Route53Config = Field(..., description="Route 53 configuration for domain setup")
    cloudfront_distribution: Any = Field(..., description="CloudFront Distribution to protect")

    class Typed:
        """Inner class, type-safe accessor for AWS CDK resources with proper typing.

        Provides strongly-typed access to AWS CDK resources for improved
        IDE support and type checking in AWS Shield Advanced protection
        configuration.
        """
        def __init__(self, config: 'AwsShieldConfig'):
            self._config = config

        @property
        def cloudfront_distribution(self) -> 'cloudfront.IDistribution':
            """CloudFront distribution interface for Shield Advanced protection.

            Returns:
                Strongly-typed CloudFront distribution interface for DDoS protection setup
            """
            return self._config.cloudfront_distribution

    @property
    def typed(self) -> Typed:
        """Access to type-safe AWS CDK resource properties.

        Provides access to the Typed inner class for strongly-typed CDK resource
        references, improving IDE support and type checking capabilities for
        AWS Shield Advanced protection configuration.

        Returns:
            Typed accessor instance for CDK resource properties
        """
        if not hasattr(self, '_typed'):
            self._typed = self.Typed(self)
        return self._typed

    @field_validator("cloudfront_distribution")
    @classmethod
    def validate_distribution(cls, value: Any) -> Any:
        """Validate CloudFront distribution CDK construct compatibility.

        Ensures the provided CloudFront distribution object implements the required
        cloudfront.IDistribution interface for proper AWS Shield Advanced integration
        and DDoS protection enrollment. Validates construct compatibility for
        Shield subscription and protection group management.

        Args:
            value: CloudFront distribution CDK construct

        Returns:
            Validated CloudFront distribution construct

        Raises:
            ValueError: If distribution doesn't implement required interface for Shield protection
        """
        return cls.validate_cloudfront_distribution(value)

typed property

Access to type-safe AWS CDK resource properties.

Provides access to the Typed inner class for strongly-typed CDK resource references, improving IDE support and type checking capabilities for AWS Shield Advanced protection configuration.

Returns:

Type Description
Typed

Typed accessor instance for CDK resource properties

Typed

Inner class, type-safe accessor for AWS CDK resources with proper typing.

Provides strongly-typed access to AWS CDK resources for improved IDE support and type checking in AWS Shield Advanced protection configuration.

Source code in mare_aws_common_lib/models/aws_shield_config.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
class Typed:
    """Inner class, type-safe accessor for AWS CDK resources with proper typing.

    Provides strongly-typed access to AWS CDK resources for improved
    IDE support and type checking in AWS Shield Advanced protection
    configuration.
    """
    def __init__(self, config: 'AwsShieldConfig'):
        self._config = config

    @property
    def cloudfront_distribution(self) -> 'cloudfront.IDistribution':
        """CloudFront distribution interface for Shield Advanced protection.

        Returns:
            Strongly-typed CloudFront distribution interface for DDoS protection setup
        """
        return self._config.cloudfront_distribution

cloudfront_distribution property

CloudFront distribution interface for Shield Advanced protection.

Returns:

Type Description
IDistribution

Strongly-typed CloudFront distribution interface for DDoS protection setup

validate_distribution(value) classmethod

Validate CloudFront distribution CDK construct compatibility.

Ensures the provided CloudFront distribution object implements the required cloudfront.IDistribution interface for proper AWS Shield Advanced integration and DDoS protection enrollment. Validates construct compatibility for Shield subscription and protection group management.

Parameters:

Name Type Description Default
value Any

CloudFront distribution CDK construct

required

Returns:

Type Description
Any

Validated CloudFront distribution construct

Raises:

Type Description
ValueError

If distribution doesn't implement required interface for Shield protection

Source code in mare_aws_common_lib/models/aws_shield_config.py
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
@field_validator("cloudfront_distribution")
@classmethod
def validate_distribution(cls, value: Any) -> Any:
    """Validate CloudFront distribution CDK construct compatibility.

    Ensures the provided CloudFront distribution object implements the required
    cloudfront.IDistribution interface for proper AWS Shield Advanced integration
    and DDoS protection enrollment. Validates construct compatibility for
    Shield subscription and protection group management.

    Args:
        value: CloudFront distribution CDK construct

    Returns:
        Validated CloudFront distribution construct

    Raises:
        ValueError: If distribution doesn't implement required interface for Shield protection
    """
    return cls.validate_cloudfront_distribution(value)
Example
from mare_aws_common_lib.models import AwsShieldConfig, Route53Config

config = AwsShieldConfig(
   route53=Route53Config(
        hosted_zone_id="Z5566778899GHI",
        domain_name="staging.webapp.io"
    ),
    cloudfront_distribution=cloudfront_dist
)