Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you specify region for aws fleet #759

Open
rew1nter opened this issue Oct 11, 2023 · 3 comments
Open

How do you specify region for aws fleet #759

rew1nter opened this issue Oct 11, 2023 · 3 comments
Labels
good first issue Good for newcomers

Comments

@rew1nter
Copy link

Apparently, something like this doesn't work
axiom-fleet named -r ap-south-1,ap-south-2,ap-southeast-1

@0xtavian 0xtavian added the good first issue Good for newcomers label Oct 11, 2023
@0xtavian
Copy link
Collaborator

Hey @rew1nter, so unfortunately aws does not automatically transfer the image to a region just because you requested the image in that region.

The providers that currently support round robin, region distribution and automatic image transfer currently are:
DO. We had to add code specifically since they don’t automatically transfer the image https://github.com/pry0cc/axiom/blob/master/interact/axiom-fleet

We didn’t have to add code for Linode or IBM since they transfer the image automatically

azure is in the same boat as AWS, we need to add code the same way we did for DO to transfer the image.

So for AWS, you'll need to manually transfer the image to the new region and hope you can still reference the image by name. If not, we’ll have to add code to the AWS providers function file https://github.com/pry0cc/axiom/blob/master/providers/aws-functions.sh

If you want to figure out the cli commands to transfer an axiom image to the new region, I can try to integrate it.

@rew1nter
Copy link
Author

My knowledge of the cloud is very basic. So It'd be really great if you could add the code for AWS like DO. I appreciate your time and effort

@ethicalhackingplayground
Copy link

ethicalhackingplayground commented Nov 23, 2023

I've been looking into this myself, I've programmed a function that can return the image_id based on the region you specify

get_image_id() {                                                                                                                                                                                                         
    region="$1"                                                                                                                                                                                                      
    images=$(aws ec2 describe-images --query 'Images[*]' --owners self --region $region)                                                                                                                             
    name=$(echo $images| jq -r '.[].Name' | tail -n 1)                                                                                                                                                               
    id=$(echo $image |  jq -r ".[] | select(.Name==\"$name\") | .ImageId")                                                                                                                                           
    echo $id                                                                                                                                                                                                 
} 

but it still isn't working correctly, I still get the following error:

The image id '[ami-fd9cecc7]' does not exist

I think it's because it's looking for the original image_id and when you copy the AMI to a different region the image ids are different, if the image_id was mutable then we might not have a problem but since they are immutable it's causing this problem, I'm sure there is a solution to this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants