aws.sns-subscription

Filters

topic

Filters subscriptons based on topic properties

example:

Identify subscriptions pointing to a topic that no longer exists. Note that this policy also ensures that the topic is in the same account and region. For cross-account subscriptions, Custodian can’t see if the topics still exist.

policies:
  - name: sns-subscription-topic
    resource: sns-subscription
    filters:
      - type: value
        key: TopicArn
        op: glob
        value: "arn:aws:sns:{region}:{account_id}:*"
      - type: topic
        key: TopicArn
        value: absent
properties:
  default:
    type: object
  key:
    type: string
  op:
    enum:
    - eq
    - equal
    - ne
    - not-equal
    - gt
    - greater-than
    - ge
    - gte
    - le
    - lte
    - lt
    - less-than
    - glob
    - regex
    - regex-case
    - in
    - ni
    - not-in
    - contains
    - difference
    - intersect
    - mod
  type:
    enum:
    - topic
  value:
    oneOf:
    - type: array
    - type: string
    - type: boolean
    - type: number
    - type: 'null'
  value_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      headers:
        patternProperties:
          ? ''
          : type: string
        type: object
      url:
        type: string
    required:
    - url
    type: object
  value_path:
    type: string
  value_regex:
    type: string
  value_type:
    enum:
    - age
    - integer
    - expiration
    - normalize
    - size
    - cidr
    - cidr_size
    - swap
    - resource_count
    - expr
    - unique_size
    - date
    - version
    - float
required:
- type

Permissions - sns:ListTopics, tag:GetResources, sns:ListTagsForResource, sns:GetTopicAttributes, sns:ListTagsForResource

Actions

delete

Action to delete a subscription

example:

policies:
  - name: external-owner-delete
    resource: sns-subscription
    filters:
      - type: value
        key: "Owner"
        value: "{account_id}"
        op: ne
    actions:
      - type: delete
properties:
  type:
    enum:
    - delete
required:
- type

Permissions - sns:Unsubscribe