EC2 Deploy
Type: DEVRAMPS:EC2:DEPLOY
Category: deploy
Version: 2.0.0
Description
Deploy a bundle to a single EC2 instance via AWS SSM.
Deploys a bundle artifact to a single EC2 instance using AWS Systems Manager (SSM) SendCommand. The bundle is automatically downloaded from S3 and extracted to the deploy path before any user commands run.
Supports two modes for specifying deployment commands:
- Flat commands: An ordered list of shell commands.
- Structured lifecycle hooks: Named phases (before_install, after_install, start, validate) each with inline commands or script file references relative to the extracted bundle root.
Exactly one of commands or hooks must be provided.
The target EC2 instance must have the SSM agent installed and an instance profile with permissions to communicate with SSM and read from the artifact S3 bucket.
Parameters
Required Parameters
| Parameter | Type | Description |
|---|---|---|
instance_id | string | The EC2 instance ID to deploy to. |
s3_url | string | S3 URL of the bundle to deploy (e.g., s3://bucket/key.zip). Use ${{ stage.artifacts['name'].s3_url }} to reference a bundle artifact. |
deploy_path | string | Directory to extract the bundle to. Defaults to /opt/devramps/deploy/. |
Optional Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
account_id | string | - | The AWS account ID where the EC2 instance is located. Defaults to stage account. |
region | string | - | The AWS region. Defaults to stage region. |
commands | array<string> | - | Flat list of shell commands to execute after bundle extraction. Mutually exclusive with hooks. |
hooks | object | - | Structured lifecycle hooks with named phases. Mutually exclusive with commands. |
timeout | integer | 30 | Deployment timeout in minutes. |
Example Usage
- type: DEVRAMPS:EC2:DEPLOY
name: Deploy to Web Server
params:
instance_id: i-0123456789abcdef0
s3_url: ${{ stage.artifacts['app-bundle'].s3_url }}
deploy_path: /opt/myapp
commands:
- sudo systemctl stop myapp
- sudo systemctl start myapp
timeout: 15