Open robbycuenot opened 1 year ago
Created a repo with the codespaces demo here: https://github.com/robbycuenot/codespaces-aws-granted
Wrote a blog post about codespaces, with a demo of granted: https://cuenot.io/articles/github-codespaces/
Bump; any thoughts on this?
I would recommend documentation that clearly shows how to setup a simple devcontainer with granted working. There's little pieces of information floating around the internet, for instance: https://medium.com/@josh.armitage/using-granted-in-a-dev-container-e355a3045c70
And then this github issue looks promising. But before running with codespaces, can we first walk with a local devcontainer?
I've demonstrated this working in a Codespace / Devcontainer environment here: https://github.com/robbycuenot/codespaces-aws-granted
I've been using this reliably for the last year or so
I've been using granted within Windows Sandbox as a way to spin up a fresh AWS dev environment with access to all SSO roles. Recently, Github Codespaces has caught my attention as a far more robust solution (which also happens to run linux natively). Using Granted within this would be a fantastic way to get new devs up to speed.
So far, I have gotten it working with the following steps, running VSCode locally on Windows 10 connected to a remote codespace. The only piece that is not yet working, is the integration with the firefox granted-containers extension.
Repro Steps:
AWS_SSO_URL
https://yourorgid.awsapps.com/start
AWS_REGION
us-east-1
- the region in which your SSO instance is locatedRUN \
Install Granted CLI \
{ "dockerFile": "Dockerfile", "features": { "ghcr.io/devcontainers/features/aws-cli:latest": {} }, "postAttachCommand": "./.devcontainer/postattach.sh", "customizations": { // Configure properties specific to VS Code. "vscode": { // Add the IDs of extensions you want installed when the container is created. "extensions": [ "GitHub.codespaces", "ms-vscode-remote.remote-containers" ] } } }
!/bin/bash
Clear out any existing AWS config
rm -rf ~/.aws rm -rf ~/.granted
Create profile for AWS SSO (ct for Control Tower)
mkdir -p ~/.aws echo "[profile ct]" >> ~/.aws/config echo "sso_start_url = $AWS_SSO_URL" >> ~/.aws/config echo "sso_region = $AWS_REGION" >> ~/.aws/config
Create granted config
mkdir -p ~/.granted echo 'DefaultBrowser = "CHROME"' >> ~/.granted/config echo CustomBrowserPath = \"$BROWSER\" >> ~/.granted/config echo CustomSSOBrowserPath = \"\" >> ~/.granted/config echo Ordering = \"\" >> ~/.granted/config echo ExportCredentialSuffix = \"\" >> ~/.granted/config
Log in to AWS SSO
aws sso login --profile ct
Populate all AWS SSO accounts/roles
granted sso populate --sso-region $AWS_REGION $AWS_SSO_URL
/vscode/bin/linux-x64/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/bin/helpers/browser.sh