Skip to content

Chore: add AWS dev tools #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 22, 2025
Merged

Chore: add AWS dev tools #109

merged 1 commit into from
May 22, 2025

Conversation

lalver1
Copy link
Member

@lalver1 lalver1 commented May 20, 2025

Closes #107

WIP (for context)

It's sort of a hassle that the AWS CLI installer is different per platform and that apt-get is not updated often, it installs version 2.9 and the current one is 2.27. I would have also thought that the Linux x86 installer would have worked in the dev container even if the host is a Mac since the base image is multi-platform, but after installation, the aws command fails.

This failure prompted this approach of determining the host architecture and passing it as an argument in the build process. The dev service successfully builds if we build it using the bin/build.sh script. Still trying to see how to work this in to VS Code's "Rebuild and Reopen in Container" command. We need to pass a dynamically generated environment variable like HOST_ARCH to the Docker Compose build context during the "Rebuild and Reopen in Container" flow. in the Dockerfile since it will return the host machine architecture, which is what we need.

This PR sets up the dev container so that aws and copilot commands can be run from the container. It maps the host's AWS credentials folder (for linux /home/user/.aws and for mac /Users/user/.aws) to the container at /home/caltrans/.aws and sets the default AWS profile to use in the dev container to pems in the .env file.

Note that this PR only installs the tools. The prerequisites to successfully run the tools are:

  • The user needs to have their local environment configured for authentication with IAM Identity Center by running aws configure sso and going through the setup. You can use the following settings:

    • SSO session name (Recommended): pems
    • SSO start URL [None]: url_provided_by_caltrans
    • SSO region [None]: us-west-2
    • SSO registration scopes [None]:
    • Default client Region [None]: us-west-2
    • CLI default output format (json if not specified) [None]:
    • Profile name [123456789011_ReadOnly]: pems
  • An active SSO session must be available, if it is not, run aws sso login inside the container to start a session.

You can confirm that the pems profile was configured successfully by running aws configure list-profiles.

@lalver1 lalver1 self-assigned this May 20, 2025
Copy link

Coverage report

This PR does not seem to contain any modification to coverable code.

@lalver1 lalver1 force-pushed the chore/aws-dev-tools branch from 8f338d2 to 66c3168 Compare May 21, 2025 12:32
@thekaveman
Copy link
Member

Thanks for that detailed explanation @lalver1! Agreed this is slightly annoying, I would have expected the same as you... but alas 😅

@lalver1 lalver1 force-pushed the chore/aws-dev-tools branch from 66c3168 to 0959788 Compare May 22, 2025 13:41
download installers directly from AWS to ensure we use the latest
version. map host credentials folder to the container. set the default
AWS profile to use in the dev container to pems.
@lalver1 lalver1 force-pushed the chore/aws-dev-tools branch from 0959788 to d09d40e Compare May 22, 2025 15:33
@lalver1 lalver1 marked this pull request as ready for review May 22, 2025 16:13
@lalver1 lalver1 requested a review from a team as a code owner May 22, 2025 16:13
Copy link
Member

@thekaveman thekaveman left a comment

Choose a reason for hiding this comment

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

Nice work 👍

@lalver1 lalver1 merged commit 859f8ed into main May 22, 2025
4 checks passed
@lalver1 lalver1 deleted the chore/aws-dev-tools branch May 22, 2025 16:36
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.

Set up aws and copilot CLI in dev container
2 participants