Skip to content

refactor: AWS cloud-init files#839

Open
Harsh9485 wants to merge 2 commits intocoder:mainfrom
Harsh9485:fix/write-files-init-script
Open

refactor: AWS cloud-init files#839
Harsh9485 wants to merge 2 commits intocoder:mainfrom
Harsh9485:fix/write-files-init-script

Conversation

@Harsh9485
Copy link
Copy Markdown
Contributor

@Harsh9485 Harsh9485 commented Apr 12, 2026

#723

Description

Refactored AWS Linux template to use cloud-init for agent initialization, bringing it to parity with the Azure template pattern.

Key Changes:

  • Moved Coder agent initialization from Terraform startup_script to cloud-init configuration
  • Added systemd service for Coder agent with proper restart policies and OOM protection
  • Implemented cloud-init cloud_final_modules with always frequency to ensure agent starts on every workspace boot
  • Added proper user creation and permissions handling via cloud-init

Type of Change

  • New module
  • New template
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Template Information

Path: registry/coder/templates/aws-linux

Testing & Validation

  • Tests pass (bun test)
  • Code formatted (bun fmt)
  • Changes tested locally

Screenshots

Screenshot 2026-04-12 085848 Screenshot 2026-04-12 090404 Screenshot 2026-04-12 091053

@matifali matifali requested a review from phorcys420 April 12, 2026 08:12
@Harsh9485 Harsh9485 changed the title refactor: cloud-init files refactor: AWS cloud-init files Apr 12, 2026
version = "~> 1.0"

agent_id = coder_agent.dev[0].id
agent_name = "dev"
Copy link
Copy Markdown
Contributor Author

@Harsh9485 Harsh9485 Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to mention that when I ran terraform init, the agent_name variable did not exist. So in my template, I removed agent_name.

Copy link
Copy Markdown
Member

@matifali matifali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#723 describes general problem with multiple templates o this PR does not address the issue in whole. I wonder how it is solving that problem for the AWS template?

@Harsh9485
Copy link
Copy Markdown
Contributor Author

#723 describes general problem with multiple templates o this PR does not address the issue in whole. I wonder how it is solving that problem for the AWS template?

Oh, my mistake. I wrote closes, but this PR is for the aws-linux template.

I only refactored the code that runs the init script in the AWS VM. I know coder/coder#22664 added a check script, but I made this PR because I think using a cloud-init file is a better way to run the init script in the AWS VM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants