Relationships
#654 Honour AWS profile default region when 'region' globalArg is omitted
Opened by mellens · 6/15/2026· Shipped 6/15/2026
Problem
All @swamp/aws/* model types default region to us-east-1 when the
region global argument is not explicitly set in a model's globalArguments.
This ignores the AWS profile's configured default region (~/.aws/config
region = or AWS_REGION/AWS_DEFAULT_REGION env vars).
The result is a silent footgun: a model created without an explicit region arg
issues CloudControl API calls against us-east-1, producing a misleading
"resource does not exist" error even when the resource is present in the
profile's actual default region.
Steps to reproduce
- AWS profile has
region = eu-west-2configured in~/.aws/config swamp model create @swamp/aws/ec2/vpc my-vpc --global-arg name=my-vpc --global-arg CidrBlock=10.0.0.0/16(no--global-arg region=eu-west-2)- A VPC with ID
vpc-0effc1af4da64c5eaexists ineu-west-2 swamp model method run my-vpc get --input identifier=vpc-0effc1af4da64c5ea- Expected: returns the VPC attributes from
eu-west-2 - Actual:
Error: "AWS::EC2::VPC Handler returned status FAILED: The vpc ID 'vpc-0effc1af4da64c5ea' does not exist"
The error gives no indication that the wrong region is being queried. The user
is left debugging the wrong thing (permissions, VPC ID format, etc.) before
discovering that region: eu-west-2 needs to be added to globalArguments.
Proposed fix
When region is not set in globalArguments, resolve it in priority order:
AWS_REGIONenv varAWS_DEFAULT_REGIONenv var- The active AWS profile's
regionvalue (from~/.aws/configor the profile resolved byAWS_PROFILE) - Current fallback:
us-east-1
This matches the behaviour of the AWS CLI and all AWS SDKs, where the region is
resolved from the environment rather than hard-defaulting to us-east-1.
Why the current default is harmful
us-east-1 is a valid region and the call succeeds at the API level — it just
returns "not found" for resources that exist elsewhere. This makes the failure
look like a resource-identity problem rather than a configuration problem,
sending users on a long debugging detour.
Affected scope
All @swamp/aws/* model types that accept a region global argument — not just
ec2 and s3. This includes rds, lambda, iam, elb, and any other AWS
service families. The fix should be applied at the shared credential/region
resolution layer used by all AWS model types, not patched per-type.
Shipped
Click a lifecycle step above to view its details.