Chore: add AWS dev tools #109
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 theLinux 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, theaws
command fails.This failure prompted this approach of determining the host architecture
and passing it as an argument in the build process. Thein the Dockerfile since it will return the host machine architecture, which is what we need.dev
service successfully builds if we build it using thebin/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 likeHOST_ARCH
to the Docker Compose build context during the "Rebuild and Reopen in Container" flow.This PR sets up the dev container so that
aws
andcopilot
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 topems
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 runningaws configure list-profiles
.