Package: r53-ptr-vpc-associator
r53_ptr_vpc_associatorThis is a program to association reverse zones to vpcs.  It is associated withhttps://github.com/aws-samples/aws-lambda-ddns-functionPrerequisitesIt is highly recommended you run this package within a python virtual environment, so
you do not affect your desktop/laptop.  To setup a python virtual environment, you should make
sure you have python3 installed, and do the following.NOTE:  Why am I doing this.  With a python virtual environment, you can create as
many virtual environmentsa as you would like, and with different python versions.  These
virtual environments are isolated in a directory, and will not affect anything else on
your computer.  This way, you can test and ensure things will work.First, figure out the path to the python version installed on your machine.which python3
/usr/local/bin/python3Next, you should pip install the virtualenv packagepip install virtualenvNext, you should create a directory, where you are going to keep the virtual environments,
and create a new virtualenv by using the path to the python version you found above.mkdir ~/virtual_environments
cd virtual_environments
virtualenv -p /usr/local/bin/python3 my_python3_virtualenvTo activate the virtual environmentsource ~/virtual_environments/my_python3_virutalenv/bin/activateNOTE:  To deactivate the virtual environmentdeactivateInstallationFor general usage:pip install r53_ptr_vpc_associatorFor local development:git clone https://github.com/rubelw/r53_ptr_vpc_associator
cd r53_ptr_vpc_associator
pip install --editable .  # Install the local dir as a package, including the 'dev' extrasExampleGetting help$ associator --help
Usage: associator [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  associate  Associated hosted zones to vpc
  zone-list  List vpcs for hosted zonesListing current zone/vpc associations$ associator zone-list --profile-name default
{
        '/hostedzone/Z1H1CDD4PZKKPB': [
        {
            'VPCRegion': 'us-east-1',
            'VPCId': 'vpc-99999999'
        },
        {
            'VPCRegion': 'us-east-2',
            'VPCId': 'vpc-99999999'
        }
    ]
}Associating zones$ associator associate --profile-name default --vpc-id vpc-99999999  --vpc-region us-east-2
[
    'Successfully associated zone: /hostedzone/A3G1CDD4PZKKPB with vpc: vpc-99999999',
    'Successfully associated zone: /hostedzone/HR2F2BVHDW5UD with vpc: vpc-99999999',
    'Successfully associated zone: /hostedzone/V6B06KVZ0ZL9U5 with vpc: vpc-99999999',
    'Successfully associated zone: /hostedzone/D7JTQ7EDFFYOWN with vpc: vpc-99999999'
]To run as a lambdaRun the make_lambda-zip command.  This will utilize the /tmp directory to
create the package.associator make-lambda-zip

################################################################################
Zip package located at: /tmp/r53_ptr_vpc_associator/LambdaDeploymentPackage.zip
################################################################################Deploy the lambda and you would any other lambda package, but ensure the following
environmental variables are set.PROFILE_NAME = lambda
VPC_ID       = vpc-xxxxxxx
VPC_REGION   = us-east-1Once deployed, you can test the lambda by creating any test in the console.
The lambda does not use the event message, so any event message will work to
trigger the lambda.TestingBefore commiting changes, be sure to run the test suite:toxPython 3 CompatibilityThis tool is compatible withpython 3.5+.Thetoxlibrary is used to run tests with multiple python versions. To run these tests, first ensure that all supported python versions are installed locally. Then, simply run:tox