pry0cc / axiom

The dynamic infrastructure framework for everybody! Distribute the workload of many different scanning tools with ease, including nmap, ffuf, masscan, nuclei, meg and many more!
MIT License
4k stars 622 forks source link

Axiom fleet init fails on AWS + multiple regions. #615

Open vulnerablecodes opened 2 years ago

vulnerablecodes commented 2 years ago

PROVIDER: AWS

COMMAND: axiom-fleet test-deploy -i 500 --regions eu-north-1,ap-south-1,eu-west-3,eu-west-2,eu-west-1,ap-northeast-3,ap-northeast-2,me-south-1,ap-northeast-1,sa-east-1,ca-central-1,ap-east-1,ap-southeast-1,ap-southeast-2,eu-central-1,us-east-1,us-east-2,us-west-1,us-west-2

OUTPUT / ERROR: Initializing new fleet 'test-deploy' with 500 instances... Cycling through following regions:eu-north-1,ap-south-1,eu-west-3,eu-west-2,eu-west-1,ap-northeast-3,ap-northeast-2,me-south-1,ap-northeast-1,sa-east-1,ca-central-1,ap-east-1,ap-southeast-1,ap-southeast-2,eu-central-1,us-east-1,us-east-2,us-west-1,us-west-2... INITIALIZING IN 5 SECONDS, CTRL+C to quit... Instances: [ test-deploy01 An error occurred (InvalidAMIID.NotFound) when calling the RunInstances operation: The image id '[ami-02ea4697a7r5c4e1]' does not exist

ISSUE: When I saw the above error, I assumed I simply had to copy my current axiom image to all of my enabled regions and it would solve the problem.

I wrote a small script that copies my current ami to all of my enabled AWS regions. The problem with this approach is that AWS (in all its glory), changes the ami id once the ami copy is placed in the new region.

Therefore I was able to confirm the error above (The image id '[ami-02ea4697a7r5c4e1]' does not exist), because that specific ami id truly does not exist since it got changed upon being copied to the new region.

POSSIBLE FIX: Update axiom to pull/honor/use the unique ami id (from each new copy) in each respective region instead of requiring the original source ami id (ami-02ea4697a7r5c4e1) from the original axiom image where it was copied from.

nicoandmee commented 2 years ago

@vulnerablecodes Could you share your script? I also encounter the same issue. I will attempt a solution...

nicoandmee commented 2 years ago

@vulnerablecodes I can haz script? I would like to add: I have this issue even with a single region, but if I go into the EC2 console I'm able to spin up the instances manually using the AMI. 🤔