Skip to main content
← Back to list
01Issue
FeatureShippedSwamp CLI
Assigneesstack72

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

  1. AWS profile has region = eu-west-2 configured in ~/.aws/config
  2. 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)
  3. A VPC with ID vpc-0effc1af4da64c5ea exists in eu-west-2
  4. swamp model method run my-vpc get --input identifier=vpc-0effc1af4da64c5ea
  5. Expected: returns the VPC attributes from eu-west-2
  6. 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:

  1. AWS_REGION env var
  2. AWS_DEFAULT_REGION env var
  3. The active AWS profile's region value (from ~/.aws/config or the profile resolved by AWS_PROFILE)
  4. 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.

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 4 MOREREVIEW+ 3 MOREPR_MERGED+ 1 MORECONTRIBUTOR_NOTIFIED

Shipped

6/15/2026, 9:24:02 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack726/15/2026, 8:22:02 PM
Editable. Press Enter to edit.

stack72 commented 6/15/2026, 9:24:28 PM

Thanks @mellens for reporting this! The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.