Skip to content

spawn launch --vpc without --subnet lands an ordinary Linux instance in the default VPC #1389

Closed

Description

@scttfrdmn

Found while fixing #1366 (where the same drop on parameter sweeps is now refused).

On a single spawn launch, --vpc sets LaunchConfig.VPCID (cmd/launch_config.go, #673), but the only readers are:

  • ensureSecurityGroup (cmd/launch_single.go): only for --mpi and for a Windows target with no security group;
  • the --fsx-create subnet choice;
  • --efa-group;
  • aws.Client.Launch, only to pick a subnet for multi-card EFA (pkg/aws/client.go, EFAInterfaces > 1).

ValidateSubnetInVPC returns early when --subnet is empty. So spawn launch --vpc vpc-x --instance-type m7i.large --ttl 1h (Linux, no MPI/EFA/FSx) sends RunInstances with no SubnetId and no NetworkInterfaces, and EC2 places it in the region's default VPC: the flag is accepted and ignored, the #673 symptom on the path #673 was meant to fix.

Evidence: grep -n 'VPCID' cmd/*.go pkg/aws/client.go pkg/aws/launch_settings.go | grep -v _test. Code trace only, not run on AWS.

Options: resolve a subnet in the VPC (for --az via GetSubnetForAZ(region, az, vpc), otherwise any default-for-AZ subnet in the VPC), or refuse --vpc without --subnet as sweeps now do (#1366).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:launcharea:networkingbugcomponent:spawntype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions