Skip to content

Commit b76fb74

Browse files
committed
docs: add CodeCommit SSH key instructions
Signed-off-by: Zakhar Dvurechensky <72825626+Zakharden@users.noreply.github.com>
1 parent af2e973 commit b76fb74

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

  • content/en/flux/integrations

content/en/flux/integrations/aws.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,55 @@ can be used to automate image updates in CodeCommit repositories.
389389
> **Note**: CodeCommit does not support resource-based policies. All access must be
390390
> configured via identity-based policies attached to IAM Roles.
391391
392+
#### SSH authentication
393+
394+
To authenticate Flux to CodeCommit over SSH, create an SSH key pair for an IAM
395+
User and upload the public key to IAM. CodeCommit assigns an SSH Key ID to the
396+
uploaded public key. Use that SSH Key ID, not the IAM user name, as the user
397+
part of the repository URL.
398+
399+
For example, after uploading `codecommit_rsa.pub` to IAM and copying the SSH
400+
Key ID, create the GitRepository source with the matching private key:
401+
402+
```sh
403+
flux create source git flux-system \
404+
--url=ssh://<ssh-key-id>@git-codecommit.<region>.amazonaws.com/v1/repos/<repository> \
405+
--branch=<branch> \
406+
--private-key-file=./codecommit_rsa \
407+
--interval=1m
408+
```
409+
410+
If the private key is encrypted, also pass `--password=<key-passphrase>`.
411+
For environments that require RSA keys, generate the key explicitly as RSA
412+
before uploading the public key to IAM:
413+
414+
```sh
415+
ssh-keygen -t rsa -b 4096 -f ./codecommit_rsa
416+
```
417+
418+
If the SSH client or Git implementation requires PEM-encoded RSA private keys,
419+
generate the key with `-m PEM`:
420+
421+
```sh
422+
ssh-keygen -t rsa -b 4096 -m PEM -f ./codecommit_rsa
423+
```
424+
425+
The same SSH URL and private key file can be used when bootstrapping Flux with
426+
an existing CodeCommit repository:
427+
428+
```sh
429+
flux bootstrap git \
430+
--url=ssh://<ssh-key-id>@git-codecommit.<region>.amazonaws.com/v1/repos/<repository> \
431+
--branch=<branch> \
432+
--private-key-file=./codecommit_rsa \
433+
--path=clusters/my-cluster
434+
```
435+
436+
For the full CodeCommit SSH setup, including where to find the SSH Key ID, see
437+
the AWS CodeCommit SSH documentation for
438+
[Linux, macOS, or Unix](https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html)
439+
and [Windows](https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-windows.html).
440+
392441
For the `GitRepository` API, the minimum required permission is `codecommit:GitPull`.
393442
For the `ImageUpdateAutomation` API, `codecommit:GitPush` is additionally required.
394443
The following identity-based policy grants read-only access for a specific repository:

0 commit comments

Comments
 (0)