Skip to content

feat(cmd/config): add aws-profile support for Glue catalog#1320

Open
rasta-rocket wants to merge 3 commits into
apache:mainfrom
rasta-rocket:aws_profile_cfg
Open

feat(cmd/config): add aws-profile support for Glue catalog#1320
rasta-rocket wants to merge 3 commits into
apache:mainfrom
rasta-rocket:aws_profile_cfg

Conversation

@rasta-rocket

Copy link
Copy Markdown

Problem

When using the Glue catalog, the CLI always resolves AWS credentials through the SDK default chain.
Users working with multiple AWS accounts or roles had to fall back to environment variables (AWS_PROFILE) or profile-switching wrappers instead of expressing the profile in their iceberg-go config (1 catalog = 1 account = 1 profile).

Fix

Add an aws-profile field to CatalogConfig in config/config.go.
When the Glue catalog is initialised in initCatalog, the profile is passed to awsconfig.LoadDefaultConfig via WithSharedConfigProfile.
A matching --aws-profile CLI flag is also wired up and takes precedence over the config file value (following the same merge pattern used by the other catalog flags).

How to test

Add an entry to ~/.iceberg-go.yaml:

catalog:
  default:
    type: glue
    aws-profile: my-aws-profile

Run any Glue command and confirm it authenticates with the named profile:

iceberg list

Alternatively, supply it on the command line:

iceberg --catalog glue --aws-profile my-aws-profile list

Unit test:

go test ./config/...

Add an `aws-profile` field to CatalogConfig so users can specify a
named AWS profile in ~/.iceberg-go.yaml instead of relying solely on
the environment default.
The profile is forwarded to `awsconfig.LoadDefaultConfig` via
`WithSharedConfigProfile` when the Glue catalog is initialised.
It can also be supplied on the command line with `--aws-profile`,
which takes precedence over the config file value.
@rasta-rocket rasta-rocket requested a review from zeroshade as a code owner June 26, 2026 11:30

@zeroshade zeroshade left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The profile plumbs through correctly - WithSharedConfigProfile into LoadDefaultConfig, then on to the Glue client and S3 ops - and mergeConf follows the same explicit-flag-wins precedence as the other fields. A couple of nits inline. One follow-up thought: the programmatic Glue path (toAwsConfig via iceberg.Properties) has no glue.profile key, so this is CLI-only for now - might be worth a follow-up issue for parity.

Comment thread config/config.go Outdated
Output string `yaml:"output"`
Credential string `yaml:"credential"`
Warehouse string `yaml:"warehouse"`
AwsProfile string `yaml:"aws-profile,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: AwsProfile carries omitempty while the sibling string fields (Output, Credential, Warehouse) don't. Harmless on unmarshal, but worth making consistent one way or the other.

Comment thread cmd/iceberg/main.go
args.Warehouse = fileConf.Warehouse
}

if !explicitFlags["aws-profile"] && len(fileConf.AwsProfile) > 0 {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this mergeConf branch and the --aws-profile flag itself aren't covered by args_test.go. A case asserting (a) --aws-profile parses onto Args, and (b) the file-config value is applied only when the flag is absent, would lock in the precedence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants