Amazon Web Services
Link AWS accounts, discover EC2 instances, and log in with Session Manager or EC2 Instance Connect, with SSO and MFA support.
Amazon Web Services (AWS)
Harbor discovers your EC2 instances and logs in to them with temporary keys, through Session Manager or EC2 Instance Connect, so instances need no open SSH port, public address or saved key.
Link an account
Open Connectors › Cloud & infrastructure › AWS and click to link an account.
Sign in with an AWS profile (recommended)
Harbor uses the profiles in your AWS config files (~/.aws/config and ~/.aws/credentials), the
same ones the AWS CLI uses. All of these work:
- access keys in a profile,
- IAM Identity Center (AWS SSO) profiles,
- roles with
source_profile, including roles that need an MFA code, and credential_processhelpers such as aws-vault.
Harbor stores no AWS credentials when you use a profile. The profile list shows how each profile signs in, and whether an SSO profile is currently signed in.
AWS files in WSL or elsewhere. The AWS files list offers ~/.aws on this computer, the
~/.aws folders it finds in WSL distributions, or any folder you choose.
Sign in with an access key
Instead of a profile, enter an access key ID and secret. The secret is encrypted like other saved secrets and only used to sign requests to AWS. Access keys don’t expire, so where your organization offers AWS SSO, a profile is safer.
Account options
- Assume role: sign in, then assume a role such as
OrganizationAccountAccessRolein the target account. - Regions to scan.
- Tag filter, such as
app=shop, to import only matching instances. - Environment given to the account’s hosts (for example Production, which turns on guardrails).
Test shows which account and identity Harbor signs in as.
AWS SSO sign-in
For SSO profiles, Sign in with AWS SSO opens your browser and shows a code to compare. The
sign-in is saved in ~/.aws/sso/cache, where the AWS CLI finds it too. When the SSO session
expires, the account shows Sign in instead of Rescan.
MFA
Roles that need an MFA code (mfa_serial in the profile, or an MFA device set on the account’s
role) ask for it when Harbor needs credentials. The credentials are reused until they expire. The
automatic scan when Harbor starts never asks; such accounts show Needs an MFA code until you
rescan.
Discover and import instances
The Hosts page lists the EC2 instances in the account’s regions, with their OS, type, state,
addresses and whether Session Manager reaches them. Pick instances to add them as hosts in an
AWS · account group. They log in as the image’s usual user (ec2-user, ubuntu, admin…).
Accounts are scanned when Harbor starts. New running instances appear in a banner with Review, Import all and dismiss. Each scan also updates saved hosts’ state and type, and the address of Instance Connect hosts whose public IP changed.
Logging in to instances
AWS SSM (Session Manager)
SSH runs inside a Session Manager session (AWS-StartSSHSession), so the instance needs no open
port or public address, only the SSM agent and sshd. Harbor logs in with a temporary EC2 Instance
Connect key, or with a key file you choose. Terminals, file browsing, tunnels, tmux and the files
panel all work as usual.
Session Manager sessions with KMS encryption turned on aren’t supported yet.
EC2 Instance Connect
Harbor creates a new Ed25519 key in memory for every connection, sends its public half with EC2 Instance Connect (valid for 60 seconds) and connects directly. No key is saved. The instance needs the EC2 Instance Connect package, which Amazon Linux and Ubuntu images include.
EC2 Instance Connect Endpoint
Instance Connect hosts can connect through the Instance Connect Endpoint in the instance’s VPC, which reaches its private address with no public IP or bastion. Discovery picks this for instances without a public address when their VPC has an endpoint. AWS closes these tunnels after an hour at most; Harbor reconnects.
IAM permissions
| To | Permissions |
|---|---|
| Discover | sts:GetCallerIdentity, ec2:DescribeInstances, ec2:DescribeImages, ssm:DescribeInstanceInformation, ec2:DescribeInstanceConnectEndpoints |
| Connect with SSM | ssm:StartSession, ssm:TerminateSession, plus ec2-instance-connect:SendSSHPublicKey for temporary keys |
| Connect with Instance Connect | ec2-instance-connect:SendSSHPublicKey |
| Connect through an endpoint | ec2-instance-connect:OpenTunnel |
Harbor only reads from your account; it never starts, stops or changes instances.