Automate the deployment of AWS SageMaker notebook instances with integrated VS Code support through code-server.
- π One-click SageMaker notebook instance deployment
- π» Integrated VS Code environment via code-server
- π Secure VPC configuration with customizable security groups
- β‘ Automatic VS Code extension installation
- π€ Idle instance management to control costs
- π Persistent VS Code settings across sessions
- AWS CLI configured with appropriate credentials
- Terraform >= 1.0.0
- Bash shell environment
- IAM role with SageMaker permissions
- VPC and subnet with appropriate network access
-
Clone this repository:
git clone <repository-url> cd <repository-name>
-
Configure your environment:
cp config/defaults.env.example config/defaults.env # Edit defaults.env with your preferred settings -
Run the setup script:
./setup_sagemaker.sh
Key settings in config/defaults.env:
AWS_PROFILE: AWS CLI profile to useAWS_REGION: Target AWS regionINSTANCE_TYPE: SageMaker instance type (e.g., ml.t3.large)TIMEZONE: Instance timezoneIDLE_TIME: Auto-shutdown timeout in seconds
The deployment creates a security group with:
- HTTPS (443) access
- HTTP (80) access
- Neo4j ports (7474, 7473, 7687)
- Configurable CIDR blocks for access control
Place a .vscode/extensions.json file in your project:
{
"recommendations": [
"ms-python.python",
"ms-toolsai.jupyter"
]
}Extensions will be automatically installed on instance start.
on_create.sh: Initial instance setup and code-server installationon_start.sh: Starts code-server and manages VS Code extensions
The instance includes automatic shutdown when idle for the configured duration (default: 1.5 hours).
- VPC isolation enabled by default
- Security group with minimal required ports
- Pre-commit hooks for security scanning
- Infrastructure as Code security checks via checkov
Ensure all pre-commit hooks pass before submitting:
pre-commit install
pre-commit run --all-files