diff --git a/src/dstack/_internal/core/backends/aws/compute.py b/src/dstack/_internal/core/backends/aws/compute.py index 3e12bb037..f913754d0 100644 --- a/src/dstack/_internal/core/backends/aws/compute.py +++ b/src/dstack/_internal/core/backends/aws/compute.py @@ -116,14 +116,14 @@ def run_job( try: subnet_id = None vpc_id = None - if self.config.vpc is not None: + if self.config.vpc_name is not None: vpc_id = aws_resources.get_vpc_id_by_name( ec2_client=ec2_client, - vpc_name=self.config.vpc, + vpc_name=self.config.vpc_name, ) if vpc_id is None: raise ComputeError( - f"No VPC named {self.config.vpc} in region {instance_offer.region}" + f"No VPC named {self.config.vpc_name} in region {instance_offer.region}" ) subnet_id = aws_resources.get_subnet_id_for_vpc( ec2_client=ec2_client, @@ -131,7 +131,7 @@ def run_job( ) if subnet_id is None: raise ComputeError( - f"Failed to get subnet for VPC {self.config.vpc} in region {instance_offer.region}" + f"Failed to get subnet for VPC {self.config.vpc_name} in region {instance_offer.region}" ) disk_size = round(instance_offer.instance.resources.disk.size_mib / 1024) response = ec2.create_instances( diff --git a/src/dstack/_internal/core/models/backends/aws.py b/src/dstack/_internal/core/models/backends/aws.py index 8c6836996..9a9e9d823 100644 --- a/src/dstack/_internal/core/models/backends/aws.py +++ b/src/dstack/_internal/core/models/backends/aws.py @@ -10,7 +10,7 @@ class AWSConfigInfo(BaseModel): type: Literal["aws"] = "aws" regions: Optional[List[str]] = None - vpc: Optional[str] = None + vpc_name: Optional[str] = None class AWSAccessKeyCreds(ForbidExtra): diff --git a/src/dstack/_internal/server/services/config.py b/src/dstack/_internal/server/services/config.py index 3a9893166..7f4d0bc37 100644 --- a/src/dstack/_internal/server/services/config.py +++ b/src/dstack/_internal/server/services/config.py @@ -29,7 +29,7 @@ class AWSConfig(ForbidExtra): type: Literal["aws"] = "aws" regions: Optional[List[str]] = None - vpc: Optional[str] = None + vpc_name: Optional[str] = None creds: AnyAWSCreds = Field(..., discriminator="type") diff --git a/src/tests/_internal/server/routers/test_backends.py b/src/tests/_internal/server/routers/test_backends.py index 300936c7d..b586abd1b 100644 --- a/src/tests/_internal/server/routers/test_backends.py +++ b/src/tests/_internal/server/routers/test_backends.py @@ -964,6 +964,6 @@ async def test_returns_config_info(self, test_db, session: AsyncSession): assert response.json() == { "type": "aws", "regions": json.loads(backend.config)["regions"], - "vpc": None, + "vpc_name": None, "creds": json.loads(backend.auth), } diff --git a/src/tests/_internal/server/routers/test_projects.py b/src/tests/_internal/server/routers/test_projects.py index 758104101..77add19d3 100644 --- a/src/tests/_internal/server/routers/test_projects.py +++ b/src/tests/_internal/server/routers/test_projects.py @@ -62,7 +62,7 @@ async def test_returns_projects(self, test_db, session: AsyncSession): "config": { "type": backend.type, "regions": json.loads(backend.config)["regions"], - "vpc": None, + "vpc_name": None, }, } ],