Skip to content

put_notification_configuration async

put_notification_configuration(
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
    topic_arn: Optional[XmlStringMaxLen255] = None,
    notification_types: Optional[AutoScalingNotificationTypes] = None,
) -> None

Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the specified topic can have messages delivered to an endpoint such as a web server or an email address.

This configuration overwrites any existing configuration.

For more information, see Amazon SNS notification options for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.

If you exceed your maximum limit of SNS topics, which is 10 per Auto Scaling group, the call fails.

Parameters:

Raises:

  • LimitExceededFault –

    You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see DescribeAccountLimits in the Amazon EC2 Auto Scaling API Reference.

  • ResourceContentionFault –

    You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • ServiceLinkedRoleFailure –

    The service-linked role is not yet ready for use.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To add an Auto Scaling notification This example adds the specified notification to the specified Auto Scaling group.

>>> await client.put_notification_configuration(auto_scaling_group_name='my-auto-scaling-group', topic_arn='arn:aws:sns:us-west-2:123456789012:my-sns-topic', notification_types=['autoscaling:TEST_NOTIFICATION'])
Source code in docs_src/capo_auto_scaling/_services/async_auto_scaling.py
async def put_notification_configuration(
    self,
    *,
    config_overrides: Optional[AsyncAutoScalingClientConfig] = None,
    auto_scaling_group_name: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = None,
    topic_arn: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = None,
    notification_types: Optional[
        "capo_auto_scaling.types.auto_scaling_notification_types.AutoScalingNotificationTypes"
    ] = None,
) -> None:
    """<p>Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the specified topic can have messages delivered to an endpoint such as a web server or an email address.</p> <p>This configuration overwrites any existing configuration.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-sns-notifications.html">Amazon SNS notification options for Amazon EC2 Auto Scaling</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p> <p>If you exceed your maximum limit of SNS topics, which is 10 per Auto Scaling group, the call fails.</p>

    Args:
        auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
        topic_arn: <p>The Amazon Resource Name (ARN) of the Amazon SNS topic.</p>
        notification_types: <p>The type of event that causes the notification to be sent. To query the notification types supported by Amazon EC2 Auto Scaling, call the <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAutoScalingNotificationTypes.html">DescribeAutoScalingNotificationTypes</a> API.</p>

    Raises:
        capo_auto_scaling.errors.limit_exceeded_fault.LimitExceededFault: <p>You have already reached a limit for your Amazon EC2 Auto Scaling resources (for example, Auto Scaling groups, launch configurations, or lifecycle hooks). For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_DescribeAccountLimits.html">DescribeAccountLimits</a> in the <i>Amazon EC2 Auto Scaling API Reference</i>.</p>
        capo_auto_scaling.errors.resource_contention_fault.ResourceContentionFault: <p>You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).</p>
        capo_auto_scaling.errors.service_linked_role_failure.ServiceLinkedRoleFailure: <p>The service-linked role is not yet ready for use.</p>
        capo_auto_scaling.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To add an Auto Scaling notification
        This example adds the specified notification to the specified Auto Scaling group.

        >>> await client.put_notification_configuration(auto_scaling_group_name='my-auto-scaling-group', topic_arn='arn:aws:sns:us-west-2:123456789012:my-sns-topic', notification_types=['autoscaling:TEST_NOTIFICATION'])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_auto_scaling.types.put_notification_configuration_type.PutNotificationConfigurationType]",
    ) -> AsyncOperationResponse[None]:
        import capo_auto_scaling._operations.auto_scaling_2011_01_01.put_notification_configuration

        (
            output,
            http_response,
        ) = await capo_auto_scaling._operations.auto_scaling_2011_01_01.put_notification_configuration.async_put_notification_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutNotificationConfiguration")
    )
    input_: capo_auto_scaling.types.put_notification_configuration_type.PutNotificationConfigurationType = {}
    if auto_scaling_group_name is not None:
        input_["auto_scaling_group_name"] = auto_scaling_group_name
    if topic_arn is not None:
        input_["topic_arn"] = topic_arn
    if notification_types is not None:
        input_["notification_types"] = notification_types

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output