Skip to content

Instantly share code, notes, and snippets.

@nguyendv
Created July 5, 2017 06:37
Show Gist options
  • Save nguyendv/b2aceeedf465eeee8381a8873cfbb7e3 to your computer and use it in GitHub Desktop.
Save nguyendv/b2aceeedf465eeee8381a8873cfbb7e3 to your computer and use it in GitHub Desktop.
Using boto3 to delete AWS resources
# Terminate instance
instance = ec2.Instance(instances_id)
instance.terminate()
# delete sec group
sec_group2 = ec2.SecurityGroup(sec_group_id)
sec_group2.delete()
# delete subnet
subnet2 = ec2.Subnet(subnet_id)
subnet2.delete()
# delete vpc
vpc2 = ec2.Vpc(vpc_id)
vpc2.delete()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment