aws.sns

Filters

cross-account

Filter to return all SNS topics with cross account access permissions

The whitelist parameter will omit the accounts that match from the return

example
properties:
  actions:
    items:
      type: string
    type: array
  everyone_only:
    type: boolean
  type:
    enum:
    - cross-account
  whitelist:
    items:
      type: string
    type: array
  whitelist_conditions:
    items:
      type: string
    type: array
  whitelist_endpoints:
    items:
      type: string
    type: array
  whitelist_endpoints_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      url:
        type: string
    required:
    - url
    type: object
  whitelist_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      url:
        type: string
    required:
    - url
    type: object
  whitelist_orgids:
    items:
      type: string
    type: array
  whitelist_orgids_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      url:
        type: string
    required:
    - url
    type: object
  whitelist_protocols:
    items:
      enum:
      - http
      - https
      - email
      - email-json
      - sms
      - sqs
      - application
      - lambda
      type: string
    type: array
  whitelist_protocols_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      url:
        type: string
    required:
    - url
    type: object
  whitelist_vpc:
    items:
      type: string
    type: array
  whitelist_vpc_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      url:
        type: string
    required:
    - url
    type: object
  whitelist_vpce:
    items:
      type: string
    type: array
  whitelist_vpce_from:
    additionalProperties: 'False'
    properties:
      expr:
        oneOf:
        - type: integer
        - type: string
      format:
        enum:
        - csv
        - json
        - txt
        - csv2dict
      url:
        type: string
    required:
    - url
    type: object
required:
- type

kms-key

Filter a resource by its associcated kms key and optionally the aliasname of the kms key by using ‘c7n:AliasName’

example
policies:
    - name:
      resource: dms-instance
      filters:
        - type: kms-key
          key: c7n:AliasName
          value: alias/aws/dms
properties:
  default:
    type: object
  key:
    type: string
  match-resource:
    type: boolean
  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
  operator:
    enum:
    - and
    - or
  type:
    enum:
    - kms-key
  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
      url:
        type: string
    required:
    - url
    type: object
  value_regex:
    type: string
  value_type:
    enum:
    - age
    - integer
    - expiration
    - normalize
    - size
    - cidr
    - cidr_size
    - swap
    - resource_count
    - expr
    - unique_size
    - date
    - version
required:
- type

Actions

delete

Deletes a SNS Topic

example

policies:
  - name: delete-bad-topic
    resource: aws.sns
    filters:
      - TopicArn: arn:aws:sns:us-east-2:123456789012:BadTopic
    actions:
      - type: delete
properties:
  type:
    enum:
    - delete
required:
- type

remove-statements

Action to remove policy statements from SNS

example

policies:
   - name: remove-sns-cross-account
     resource: sns
     filters:
       - type: cross-account
     actions:
       - type: remove-statements
         statement_ids: matched
properties:
  statement_ids:
    oneOf:
    - enum:
      - matched
      - '*'
    - items:
        type: string
      type: array
  type:
    enum:
    - remove-statements
required:
- statement_ids
- type

set-encryption

Set Encryption on SNS Topics

By default if no key is specified, alias/aws/sns is used

key can either be a KMS key ARN, key id, or an alias

example

policies:
    - name: set-sns-topic-encryption
      resource: sns
      actions:
        - type: set-encryption
          key: alias/cmk/key
          enabled: true

    - name: set-sns-topic-encryption-with-id
      resource: sns
      actions:
        - type: set-encryption
          key: abcdefgh-1234-1234-1234-123456789012
          enabled: true

    - name: set-sns-topic-encryption-with-arn
      resource: sns
      actions:
        - type: set-encryption
          key: arn:aws:kms:us-west-1:123456789012:key/abcdefgh-1234-1234-1234-123456789012
          enabled: true
properties:
  enabled:
    type: boolean
  key:
    type: string
  type:
    enum:
    - set-encryption
required:
- type