Deploy a service using AWS CodeDeploy
This guide includes steps that require integration with GitHub:
- GitHub (Ocean) - uses the Ocean framework. We strongly recommend this integration for new and migrated setups.
- GitHub (Sunset) - uses a GitHub app that is in sunset and will be fully deprecated on September 15, 2026.
This guide walks you through implementing a self-service action in Port that triggers an AWS CodeDeploy deployment targeting an EC2 instance. This functionality enables automated deployments directly from your developer portal.
Prerequisitesβ
-
Complete the onboarding process.
-
Access to an AWS account with permissions to manage S3, CodeDeploy and EC2.
-
An existing AWS CodeDeploy application and deployment group.
-
A GitHub repository containing your application code.
-
Install Port's GitHub integration:
- GitHub (Ocean)
- GitHub (Sunset)
The GitHub Ocean integration needs to be installed.
Port's GitHub app needs to be installed.
Implementationβ
We will use a practical example where a developer deploys a website to an EC2 instance using AWS CodeDeploy. The websiteβs source code is stored in a GitHub repository. As part of the deployment process, we will use a GitHub Actions workflow to:
-
Package the website code into a ZIP file.
-
Upload the ZIP file to an S3 bucket.
-
Trigger an AWS CodeDeploy deployment that pulls the bundle from S3 and deploys it to an EC2 instance.
To implement this use-case using a GitHub workflow, follow these steps:
Add GitHub secrets
In your GitHub repository, go to Settings > Secrets and add the following secrets:
AWS_ACCESS_KEY_ID- AWS IAM user's access key.AWS_SECRET_ACCESS_KEY- AWS IAM user's secret access key.AWS_REGION_NAME- AWS region (e.g.,us-east-1).S3_BUCKET_NAME- Name of the S3 bucket used by CodeDeploy.
Add GitHub workflowβ
Create the file .github/workflows/deploy-website.yaml in the .github/workflows folder of your repository.
We recommend creating a dedicated repository for the workflows that are used by Port actions.
GitHub Workflow (Click to expand)
name: Deploy Website with CodeDeploy
on:
workflow_dispatch:
inputs:
applicationName:
description: 'AWS CodeDeploy application name'
required: true
type: string
deploymentGroup:
description: 'AWS CodeDeploy deployment group name'
required: true
type: string
jobs:
deploy:
runs-on: ubuntu-latest
env:
AWS_REGION: ${{ secrets.AWS_REGION_NAME }}
S3_BUCKET: ${{ secrets.S3_BUCKET_NAME }}
steps:
- name: Checkout source
uses: actions/checkout@v6
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Zip source code
run: |
zip -r website.zip index.html scripts appspec.yml
- name: Upload to S3
run: |
TIMESTAMP=$(date +%s)
S3_KEY=website-$TIMESTAMP.zip
aws s3 cp website.zip s3://$S3_BUCKET/$S3_KEY
echo "S3_KEY=$S3_KEY" >> $GITHUB_ENV
- name: Deploy via CodeDeploy
run: |
aws deploy create-deployment \
--application-name "${{ github.event.inputs.applicationName }}" \
--deployment-group-name "${{ github.event.inputs.deploymentGroup }}" \
--s3-location bucket=$S3_BUCKET,key=$S3_KEY,bundleType=zip \
--file-exists-behavior OVERWRITE \
--region $AWS_REGION
Set up self-service actionβ
We will then create a self-service action in Port to handle triggering AWS CodeDeploy:
-
Head to the self-service page of your portal.
-
Click on the
+ New Actionbutton. -
Click on the
{...} Edit JSONbutton. -
Copy and paste the following JSON configuration into the editor.
- GitHub (Ocean)
- GitHub (Sunset)
Trigger AWS CodeDeploy (Click to expand)
{"identifier": "trigger_aws_code_deploy_app","title": "Trigger AWS CodeDeploy Application","icon": "AWS","description": "A self service action to deploy a website to EC2 via AWS CodeDeploy","trigger": {"type": "self-service","operation": "CREATE","userInputs": {"properties": {"applicationName": {"type": "string","title": "Application Name","description": "CodeDeploy application name"},"deploymentGroup": {"type": "string","title": "CodeDeploy deployment group name"}},"required": ["applicationName","deploymentGroup"],"order": ["applicationName","deploymentGroup"]}},"invocationMethod": {"type": "INTEGRATION_ACTION","installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>","integrationActionType": "dispatch_workflow","integrationActionExecutionProperties": {"org": "<YOUR_GITHUB_ORG>","repo": "<YOUR_GITHUB_REPO>","workflow": "deploy-website.yaml","workflowInputs": {"{{ spreadValue() }}": "{{ .inputs }}"},"reportWorkflowStatus": true}},"requiredApproval": false}Trigger AWS CodeDeploy (Click to expand)
Modification RequiredMake sure to replace
<GITHUB_ORG>and<GITHUB_REPO>with your GitHub organization and repository names respectively.{"identifier": "trigger_aws_code_deploy_app","title": "Trigger AWS CodeDeploy Application","icon": "AWS","description": "A self service action to deploy a website to EC2 via AWS CodeDeploy","trigger": {"type": "self-service","operation": "CREATE","userInputs": {"properties": {"applicationName": {"type": "string","title": "Application Name","description": "CodeDeploy application name"},"deploymentGroup": {"type": "string","title": "CodeDeploy deployment group name"}},"required": ["applicationName","deploymentGroup"],"order": ["applicationName","deploymentGroup"]}},"invocationMethod": {"type": "GITHUB","org": "<YOUR_GITHUB_ORG>","repo": "<YOUR_GITHUB_REPO>","workflow": "deploy-website.yaml","workflowInputs": {"{{ spreadValue() }}": "{{ .inputs }}"},"reportWorkflowStatus": true},"requiredApproval": false} -
Click
Save.
Now you should see the Trigger AWS CodeDeploy Application action in the self-service page. π
Let's test it!β
-
Head to the self-service page of your portal.
-
Choose the
Trigger AWS CodeDeploy Applicationaction. -
Enter the required information.
-
Click on
Execute. -
Wait for deployment completion π