This project uses Pulumi to provision AWS EC2 instances for educational purposes, automatically creating student user accounts with comprehensive logging via CloudWatch.
- Multi-Stack Support: Separate configurations for different classes (class-a, class-b...)
- Automated Student Account Creation: Creates Linux users with password authentication
- SSH Key Management: Uses your local SSH public key for access
- Real-time Logging: All student shell activity logged to CloudWatch
- Security Group Configuration: SSH access with proper firewall rules
- CloudWatch Integration: Centralized log monitoring and retention
- Node.js (v14 or later)
- Pulumi CLI
- AWS CLI configured with appropriate credentials
-
Clone and install dependencies:
npm install
-
Configure AWS credentials:
aws configure
-
Select a stack (class):
# For class-a pulumi stack select class-a # For class-b pulumi stack select class-b
-
Configure students (optional):
Each stack is configured with specific students in the respective
Pulumi.<stack>.yamlfiles. To modify students, edit the appropriate configuration file:config: aws:region: us-east-1 cop-conference-lecture:students: '[ "student1", "student2", "student3" ]'
-
Deploy the infrastructure:
pulumi up
-
Get connection details:
pulumi stack output publicIp pulumi stack output publicDns
Students can connect via SSH using password authentication:
- Username: Their assigned student name (e.g.,
student1) - Password: Same as username (e.g.,
student1)
ssh student1@<public-ip>
# Password: student1Note: Password authentication is enabled for educational purposes in this lab environment. This is not recommended for production systems due to security concerns.
Administrators can connect using SSH key authentication:
- Username:
ec2-user(default AWS user) - Authentication: SSH public key (eg.
~/.ssh/id_rsa.pub)
ssh -i ~/.ssh/id_rsa ec2-user@<public-ip>- CloudWatch Logs: All student shell activity is captured
- Log Group:
<stack-name>-logs - Log Retention: 7 days
- Log Files:
/var/log/cloud-init-output.log- Instance initialization/var/log/student-logs.log- Student shell activity
You can customize the deployment by modifying the StudentServer constructor in index.ts:
const studentServer = new StudentServer(pulumi.getStack(), {
pubKey,
students,
instanceType,
amiId,
});Purpose: Educational infrastructure for coding workshops