Skip to content

Commit

Permalink
Delete SNS topics
Browse files Browse the repository at this point in the history
  • Loading branch information
Ville Seppanen committed Jun 19, 2017
1 parent b065ec6 commit abd0624
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This utility tool will delete all resources from your AWS account. Whitelisted r
- EC2 security groups
- EBS snapshots
- CloudWatch alarms
- SNS topics
- S3 buckets

### Usage
Expand Down
5 changes: 5 additions & 0 deletions clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ def not_default(resource):
filter_function=not_default
)

def delete_sns_topics(self, sns):
self._simple_delete(sns.list_topics, sns.delete_topic, "sns_topics", "Topics", "TopicArn")


def _get_config_from_file(filename):
config = {}
Expand All @@ -160,10 +163,12 @@ def get_boto_session(profile_name):
s3 = boto_session.client("s3")
s3_resource = boto_session.resource("s3")
sts = boto_session.client("sts")
sns = boto_session.client("sns")

cleaner.run_safety_checks(sts, iam, iam_resource)
cleaner.delete_cloudformation_stacks(cf)
cleaner.delete_cloudwatch_alarms(cloudwatch)
cleaner.delete_sns_topics(sns)
cleaner.delete_amis(sts, ec2)
cleaner.delete_snapshots(sts, ec2)
cleaner.delete_securitygroups(ec2)
Expand Down
2 changes: 2 additions & 0 deletions config.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ preserved_resources:
- name-of-bucket-to-save
securitygroups:
- sg-01234567
sns_topics:
- arn-of-topic-to-save

0 comments on commit abd0624

Please sign in to comment.