4 ms·
Does it allow me to run a script against an EC2 instance, say, and it spins it up and take care of everything? Something like packer would but without creating
by manojlds 2y ago
Does it allow me to run a script against an EC2 instance, say, and it spins it up and take care of everything? Something like packer would but without creating an AMI
- verdverm 2y agofyi, in Packer, there is an option to not create the final image
- manojlds 2y agoYes! Which is what I am doing now, but was feeling it was using a tool that wasn't meant for that job a bit.
- letmeinhere 2y agoYou ever try cloud-init? You can specify your config in user-data when launching pretty generic AMIs. https://cloudinit.readthedocs.io/en/latest/index.html https://cloudinit.readthedocs.io/en/latest/index.html
- manojlds 2y agoI don't want to launch instances (and run a script to set it up etc), I want to run my script THROUGH an instance.
- nijave 2y agoI made this a while back that utilizes shell script and AWS cli to spin up and cloud init to run things https://github.com/nijave/cloud-init-golden-image https://github.com/nijave/cloud-init-golden-image For this type of use case AWS has managed services like Batch, ECS, or even auto scaling groups that can make this easier depending on what you're trying to achieve. ECS with Fargate executors is fairly easy to run arbitrary things inside a VPC
- Fizzadar 2y agoYou'd need to create the EC2 instance outside of pyinfra (ie in Terraform). This could be done as part of the inventory itself, but wouldn't self-delete afterwards. If using Terraform there's a connector that allows you to plug Terraform output as a pyinfra inventory: https://docs.pyinfra.com/en/2.x/connectors/terraform.html https://docs.pyinfra.com/en/2.x/connectors/terraform.html