A set of CloudFormation stacks that will create the necessary infrastructure to compile Python packages on Amazon Linux. Assumes no existing infrastructure(i.e. particular VPCs or subnets etc), instead it provisions everything necessary for it to run. You only pay for its lifetime costs(a cent or fraction thereof per run, as it's ~10m).
- Launch bootstrap stack to create IAM resources and S3 bucket.
- Sync templates to the bucket:
- aws s3 sync aws-cloudformation/arch-yamls s3://<devops_bucket_name>/lambda-precompile-package/templates
- Create an EC2 keypair named -precompile-key in your region of choice
- Launch the landing_zone template, filling in the parameters(all of which are required).
- Wait for all of the child stacks to come up - when complete, you'll be able to log into the instance.
- Of course, you don't even need to do this - your package and its dependencies have been zipped and uploaded to s3://<devops_bucket_name>/lambda-precompile-package/packages/<package_name>.zip!
- You'll receive an email with a link to the file(which you'll need to download with aws s3 cp, as it isn't publicly accessible)
- Should you want to compile some more while you're at it, though, you can do so with:
- pip3 install <package_name> -t . You'll still need to zip it and transfer it off the instance though.
- Once finished, terminate the parent stack if you don't want to keep it around(and pay for it).