DEV Community

Latchu@DevOps
Latchu@DevOps

Posted on

πŸš€ AWS CodePipeline Now Supports Deploy Spec Files for EC2 Deployments – Here's How It Works!

AWS CodePipeline now supports Deploy Spec file configurations in the EC2 Deploy action!

This feature brings more flexibility, transparency, and debugging ease to your CI/CD pipelines. Let me break it down for you with a simple example.

πŸ†• What's New?

You can now:

  • Add a Deploy Spec file (YAML format) to your source repo.
  • Reference it in your EC2 Deploy action in CodePipeline.
  • Enjoy real-time EC2 instance-level deployment status in the console.

Think of this like appspec.yml from CodeDeployβ€”but with added power directly from your pipeline.

πŸ”§ Example Use Case

Let’s say you’re deploying a web app to EC2 instances using CodePipeline.

Previously:

  • Deployment steps were defined manually in the pipeline or via the default behavior.
  • Debugging large-scale deployments was tediousβ€”sifting through logs to find which instance failed.

Now:

  • You can define deployment logic in a version-controlled file (deployspec.yml).
  • You get per-instance status in real time via the deployment monitoring interface.

πŸ“ Folder Structure

my-web-app/
β”œβ”€β”€ index.html
β”œβ”€β”€ start_server.sh
β”œβ”€β”€ stop_server.sh
└── deployspec.yml   πŸ‘ˆ New!

Enter fullscreen mode Exit fullscreen mode

✍️ Sample deployspec.yml

version: 0.0
os: linux
files:
  - source: /
    destination: /var/www/html
hooks:
  BeforeInstall:
    - location: stop_server.sh
      timeout: 60
      runas: ec2-user
  AfterInstall:
    - location: start_server.sh
      timeout: 60
      runas: ec2-user

Enter fullscreen mode Exit fullscreen mode

This defines:

  • File copy paths
  • Pre/post-install hook scripts
  • Execution user and timeouts

πŸ”— CodePipeline EC2 Deploy Configuration

In the EC2 Deploy action of your pipeline, add this:

"configuration": {
  "ApplicationName": "MyApp",
  "DeploymentGroupName": "MyDeploymentGroup",
  "DeploySpecFile": "deployspec.yml"
}

Enter fullscreen mode Exit fullscreen mode

βœ… This tells the pipeline to use the deployspec.yml from your source artifact.

πŸ–₯️ Enhanced Deployment Debugging

CodePipeline now also gives you:

Real-time deployment status per EC2 instance

Easier troubleshootingβ€”no more scanning massive logs

Faster detection of which EC2 instance failed and why
Enter fullscreen mode Exit fullscreen mode

🎯 Final Thoughts

This update is a game-changer for teams deploying across many EC2 instances. You get:

Cleaner pipeline configs

Better visibility into deployments

Version-controlled deployment logic
Enter fullscreen mode Exit fullscreen mode

πŸ’¬ Have you tried this new feature yet? Share your thoughts or use cases in the comments below!

Heroku

Deploy with ease. Manage efficiently. Scale faster.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

ACI image

ACI.dev: Fully Open-source AI Agent Tool-Use Infra (Composio Alternative)

100% open-source tool-use platform (backend, dev portal, integration library, SDK/MCP) that connects your AI agents to 600+ tools with multi-tenant auth, granular permissions, and access through direct function calling or a unified MCP server.

Check out our GitHub!