Skip to main content

AWS Security Group Backup

AWS Security Group Backup is a tiny library that allows to backup and restore AWS security groups. It may be useful if you want to delete security groups that are not used, but you want to have a backup in case you need to restore them.

If security group references other security groups, then they will be also backed up. On restore, if some referenced security group is not found, then it will be restored.

Library doesn't restore security group IDs, so you need to update your environment to use new security group IDs.

Installation

pip install aws-sg-backup

Required IAM permissions

To use this library, you need to have the following IAM permissions:

  • ec2:DescribeSecurityGroups
  • ec2:CreateSecurityGroup
  • ec2:AuthorizeSecurityGroupIngress
  • ec2:AuthorizeSecurityGroupEgress
  • ec2:RevokeSecurityGroupEgress
  • s3:PutObject
  • `s3:GetObject

Usage

Library provides two functions: backup_security_group and restore_security_group. Both functions take the following arguments:

  • security_group_id - ID of the security group to backup or restore
  • backup_path - local file path or S3 bucket path (e.g. bucket_name/path/to/dir). Depends on backup_target argument.
  • backup_target - backup target. Can be either Backup.S3 or Backup.LOCAL. If Backup.S3 is specified, backup will be created in S3 bucket. If Backup.LOCAL is specified, backup will be stored in the local file system.

Metadata

Release files for aws-sg-backup 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-sg-backup 0.1.0
File Size Uploaded
aws-sg-backup-0.1.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-sg-backup 0.1.0
File Interpreter ABI Platform
aws_sg_backup-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.2 kB

Release files / aws-sg-backup-0.1.0.tar.gz

Download URL aws-sg-backup-0.1.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d9b6477f6c0216b6c53aa133033c00084cf85582697a53ab8108176fc53cab91
BLAKE2b-256 checksum
How to use checksums
8d099687fdef6ded26a5f5bb141f32e751b1f9debd8eb3dcbf70de5cd500d459
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.9 Darwin/22.1.0

Release files / aws_sg_backup-0.1.0-py3-none-any.whl

Download URL aws_sg_backup-0.1.0-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b00d43346cbf751186d2eee18d485706950d24e9b3a811b026b5871305375c09
BLAKE2b-256 checksum
How to use checksums
e53dc5d89ebffb400eff5ad4a6ba8020936a57fb73a58e7b7ff09b911d68e369
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.9 Darwin/22.1.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page