TopicHook

class aws_cdk.aws_autoscaling_hooktargets.TopicHook(topic)

Bases: object

Use an SNS topic as a hook target.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_autoscaling_hooktargets as autoscaling_hooktargets
from aws_cdk import aws_sns as sns

# topic: sns.Topic

topic_hook = autoscaling_hooktargets.TopicHook(topic)
Parameters:

topic (ITopic) –

Methods

bind(_scope, *, lifecycle_hook, role=None)

If an IRole is found in options, grant it topic publishing permissions.

Otherwise, create a new IRole and grant it topic publishing permissions.

Parameters:
  • _scope (Construct) –

  • lifecycle_hook (LifecycleHook) – The lifecycle hook to attach to. [disable-awslint:ref-via-interface]

  • role (Optional[IRole]) – The role to use when attaching to the lifecycle hook. [disable-awslint:ref-via-interface] Default: : a role is not created unless the target arn is specified

Return type:

LifecycleHookTargetConfig

Returns:

the IRole with topic publishing permissions and the ARN of the topic it has publishing permission to.