Sign inSign up

barkinggecko/aws-cdk-devcontainer

By barkinggecko

•Updated about 2 years ago

Ubuntu-based environment configured with CDK and AWS CLI v2 for use as a devcontainer.

Image
0

1.3K

barkinggecko/aws-cdk-devcontainer repository overview

⁠aws-cdk-devcontainer

'devcontainers' save huge amounts of time when onboarding new developers to a project or spinning up projects you may not have worked with for a while. A devcontainer should provide a pre-configured environment for building, deploying and in many cases running a project.

This devcontainer configuration provides an Ubuntu-based environment pre-configured with CDK and AWS CLI v2. It even mounts your ~/.aws directory within the container so you can re-use your existing AWS credentials.

⁠Source

Source and usage instructions can be found at https://github.com/barkinggecko/aws-cdk-devcontainer⁠

⁠Dependencies

  • A devcontainer.json file is required to run this container in IDEs that support the Development Containers Specification (https://containers.dev/⁠), such as VS Code.
// For format details, see https://aka.ms/devcontainer.json. 
{
	"name": "aws-cdk-devcontainer",

	// Choose `image` to get started quickly using the image already created, according to the Dockerfile
	// in this directory, in hub.docker.com.
	//
	// Alternatively, use `build` to build your image from the Dockerfile in this directory. This will 
	// ensure you have built with the latest version of all packages but also provides you with the option
	// to extend the aws-dev-container by creating your own Dockerfile that starts with 
	// `FROM barkinggecko/aws-cdk-devcontainer`.
	//
	// See https://containers.dev/guide/dockerfile for more information.

	"image": "barkinggecko/aws-cdk-devcontainer",

	// "build": {
    //     // Path is relataive to the devcontainer.json file.
    //     "dockerfile": "Dockerfile"
    // },

	"mounts": [
		{ "source": "/home/${localEnv:USER}/.aws", "target": "/home/devcontainer/.aws", "type": "bind" }
	],

	// Features to add to the dev container. More info: https://containers.dev/features.
	// "features": {},

	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [],

	// Use 'postCreateCommand' to run commands after the container is created.
	// "postCreateCommand": "",

	// Configure tool-specific properties.
	"customizations": {
		// Configure properties specific to VS Code.
		"vscode": {
			// Add the IDs of extensions you want installed when the container is created.
			// Alternatively, just use Setting Sync to ensure you are always running your
			// preferred VS Code setup ( https://code.visualstudio.com/docs/editor/settings-sync ).
			"extensions": [
				// "amazonwebservices.aws-toolkit-vscode",
				// "devadvice.serverlessconsole",
			]
		}
	},

	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
	// "remoteUser": "root"
}
  • devcontainer.json currently references the source directories for mounts as if they were on a Linux file system. Edit the value of source accordingly if you are on another platform.

⁠Features

  • The devcontainer supports Python and Node/Typescript CDKs.
  • The devcontainer will mount a project directory from your Docker host as a volume (available in the container as /workspaces/<project name> when running the devcontainer in VS Code).
  • The devcontainer will mount the ~/.aws directory from your Docker host as a volume (available as ~/.aws in the container). This very conveniently means that when operating within the container, you will be able to access AWS CLI profiles and credentials from your host machine.
  • The devcontainer provides auto-completion for AWS CLI.
  • The devcontainer runs as user devcontainer with UID 1000 and GID 1000. This provides added security over typical container configurations that run as root. Given most users (on Ubuntu at least) run with UID 1000 and GID 1000, then files created within the container in volumes that are accessible outside the container (such as the project directory) should be editable by non-root users outside the container. This is a convenience that, for example, should allow users to perform git operations both inside and outside the container on the project directory.
  • The devcontainer provides git-remote-codecommit for those using AWS CodeCommit repositories.
  • The devcontainer supports AWS single sign-on via yawsso.

Tag summary

Content type

Image

Digest

sha256:addad1289…

Size

557.4 MB

Last updated

about 2 years ago

docker pull barkinggecko/aws-cdk-devcontainer