From f9c5b6b0817ed4ed98517a58cff07086cbba1e23 Mon Sep 17 00:00:00 2001 From: Christian Laffin Date: Thu, 1 Jul 2021 12:50:31 +0100 Subject: [PATCH] Added AMI ID setting --- cloudproxy/providers/aws/functions.py | 2 +- cloudproxy/providers/settings.py | 3 +++ docs/aws.md | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cloudproxy/providers/aws/functions.py b/cloudproxy/providers/aws/functions.py index 49d7728..b8da108 100644 --- a/cloudproxy/providers/aws/functions.py +++ b/cloudproxy/providers/aws/functions.py @@ -44,7 +44,7 @@ def create_proxy(): sg_id = ec2_client.describe_security_groups(GroupNames=["cloudproxy"]) sg_id = sg_id["SecurityGroups"][0]["GroupId"] instance = ec2.create_instances( - ImageId="ami-096cb92bb3580c759", + ImageId=config["providers"]["aws"]["ami"], MinCount=1, MaxCount=1, InstanceType=config["providers"]["aws"]["size"], diff --git a/cloudproxy/providers/settings.py b/cloudproxy/providers/settings.py index 4bb5f28..ac3e0bd 100644 --- a/cloudproxy/providers/settings.py +++ b/cloudproxy/providers/settings.py @@ -19,6 +19,7 @@ "scaling": {"min_scaling": 0, "max_scaling": 0}, "size": "", "region": "", + "ami": "", "secrets": {"access_key_id": "", "secret_access_key": ""}, }, "hetzner": { @@ -80,6 +81,8 @@ config["providers"]["aws"]["size"] = os.environ.get("AWS_SIZE", "t2.micro") config["providers"]["aws"]["region"] = os.environ.get("AWS_REGION", "eu-west-2") +config["providers"]["aws"]["ami"] = os.environ.get("AWS_AMI", "ami-096cb92bb3580c759") + # Set Hetzner config config["providers"]["hetzner"]["enabled"] = os.environ.get( "HETZNER_ENABLED", False diff --git a/docs/aws.md b/docs/aws.md index 606ae8e..2ff927b 100644 --- a/docs/aws.md +++ b/docs/aws.md @@ -28,6 +28,8 @@ Now you have your access key and secret access key, you can now use AWS as a pro ``AWS_MAX_SCALING`` - this is currently unused, however will be when autoscaling is implemented. We recommend you set this as the same as the minimum scaling to avoid future issues for now. Default value: 2 -``AWS_SIZE`` - this sets the droplet size, we recommend the smallest droplet as the volume even a small droplet can handle is high. Default value: t2.micro +``AWS_SIZE`` - this sets the instance size, we recommend the smallest instance as the volume even a small instance can handle is high. Default value: t2.micro -``AWS_REGION`` - this sets the region where the droplet is deployed. Some websites may redirect to the language of the country your IP is from. Default value: eu-west-2 +``AWS_REGION`` - this sets the region where the instance is deployed. Some websites may redirect to the language of the country your IP is from. Default value: eu-west-2 + +``AWS_AMI`` - this sets the AMI the instance is deployed with. The default AMI is for Ubuntu 20.04, however each region may use a different AMI ID. If not using eu-west-2, you may need to set a different AMI ID. See the AWS AMI Marketplace for Ubuntu 20.04 AMI IDs. Default value: ami-096cb92bb3580c759 \ No newline at end of file