fix password&resolution
This commit is contained in:
@@ -36,15 +36,22 @@ DEFAULT_REGION = "us-east-1"
|
||||
# todo: Add doc for the configuration of image, security group and network interface
|
||||
# todo: public the AMI images
|
||||
IMAGE_ID_MAP = {
|
||||
"us-east-1": "ami-09138bff939f82bd8",
|
||||
"ap-east-1": "ami-0c092a5b8be4116f5",
|
||||
"us-east-1": {
|
||||
(1920, 1080): "ami-09138bff939f82bd8"
|
||||
},
|
||||
"ap-east-1": {
|
||||
(1920, 1080): "ami-0c092a5b8be4116f5"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def _allocate_vm(region=DEFAULT_REGION):
|
||||
def _allocate_vm(region=DEFAULT_REGION, screen_size=(1920, 1080)):
|
||||
|
||||
if region not in IMAGE_ID_MAP:
|
||||
raise ValueError(f"Region {region} is not supported. Supported regions are: {list(IMAGE_ID_MAP.keys())}")
|
||||
if screen_size not in IMAGE_ID_MAP[region]:
|
||||
raise ValueError(f"Screen size {screen_size} not supported for region {region}. Supported: {list(IMAGE_ID_MAP[region].keys())}")
|
||||
ami_id = IMAGE_ID_MAP[region][screen_size]
|
||||
|
||||
ec2_client = boto3.client('ec2', region_name=region)
|
||||
instance_id = None
|
||||
@@ -86,7 +93,7 @@ def _allocate_vm(region=DEFAULT_REGION):
|
||||
run_instances_params = {
|
||||
"MaxCount": 1,
|
||||
"MinCount": 1,
|
||||
"ImageId": IMAGE_ID_MAP[region],
|
||||
"ImageId": ami_id,
|
||||
"InstanceType": INSTANCE_TYPE,
|
||||
"EbsOptimized": True,
|
||||
"NetworkInterfaces": [
|
||||
|
||||
Reference in New Issue
Block a user