> For the complete documentation index, see llms.txt.
Skip to main content

Check out Port for yourself ➜ 

Manage and visualize cloud resources

Implement with AI

Send this guide to your coding agent.

Prerequisite: Install Port MCP

This guide demonstrates how to manage and visualize AWS, Azure, and GCP cloud resources in Port using cloud integrations, workflows, self-service actions, GitHub Actions, and dashboards.

Use this guide as the consolidated entry point for common cloud resource day-2 operations. Each resource section includes the relevant data model, integration mapping, day-2 operations, and visualization setup from the original resource-specific guide.

The AWS Auto Scaling Groups, AWS EC2 instances, and AWS S3 buckets and RDS instances sections use Port workflows. The other sections use self-service actions.

Common use cases​

  • Monitor cloud resources across AWS, Azure, and GCP from Port dashboards.
  • Trigger day-2 actions such as start, stop, restart, scale, purge, redrive, renew, delete, and rollback from Port.
  • Give platform teams a consistent self-service experience for cloud operations.
  • Surface security and operational signals such as encryption, public access, health status, certificate expiration, and deletion protection.

Prerequisites​

This guide assumes the following:

  • You have a Port account and have completed the onboarding process.
  • The relevant cloud integration is installed for the resource you want to manage:
  • A GitHub integration is installed to run the GitHub Actions used by the workflows and self-service actions:
  • You have access to a GitHub repository for storing the GitHub Actions workflow files used by the workflows and self-service actions.

Select a cloud resource​

ResourceWhat you can manage
AWS ACM certificatesMonitor certificate status and expiration, then request, renew, and delete certificates through Port workflows.
AWS Auto Scaling GroupsMonitor capacity and scaling configuration, then scale and resize Auto Scaling Groups with workflows.
AWS SQS queuesMonitor queue health, then purge queues, redrive dead-letter queues, and delete queues through Port workflows.
AWS ECS servicesMonitor ECS services, scale services, restart services, update task definitions, run health checks, roll back deployments, and delete services.
AWS EC2 instancesMonitor EC2 instances and run start, reboot, and terminate workflows.
AWS S3 buckets and RDS instancesMonitor S3 and RDS security posture, and run reboot and delete RDS workflows.

AWS ACM certificates​

Use this section to bring your AWS ACM certificate management experience into Port using workflows.

In this section, we will:

  • Ingest ACM certificate data into Port's context lake using Port's AWS integration.
  • Set up workflows to manage ACM certificates (request, renew, and delete).
  • Build dashboards in Port to monitor and take action on your ACM resources.

Prerequisites

This section assumes the following:

  • You have a Port account and have completed the onboarding process.
  • Access to the workflows beta feature.
  • Port's AWS integration is installed in your account.
  • GitHub Ocean is installed in your account.
  • You have access to a GitHub repository for storing the GitHub Actions workflow files used by the Port workflows.
Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

AWS Certificate Manager dashboard overview Certificates table with expiration and day-2 workflows

Set up data model​

When installing the AWS integration in Port, the AWS Account blueprint is created by default. However, the ACM Certificate blueprint is not created automatically, so we will create it manually.

Create the ACM certificate blueprint​

  1. Go to the Builder page in Port.
  2. Click on + Blueprint.
  3. Click on the {...} button in the top right corner, and choose Edit JSON.
  4. Add this JSON schema:
AWS ACM Certificate blueprint (click to expand)
{
"identifier": "acmCertificate",
"description": "This blueprint represents an SSL/TLS certificates for your Amazon Web Services-based websites and applications",
"title": "ACM Certificate",
"icon": "AWS",
"schema": {
"properties": {
"createdAt": {
"icon": "DefaultProperty",
"type": "string",
"title": "Created At",
"format": "date-time"
},
"inUse": {
"icon": "DefaultProperty",
"type": "boolean",
"title": "In Use"
},
"keyAlgorithm": {
"icon": "DefaultProperty",
"type": "string",
"title": "Key Algorithm"
},
"expirationDate": {
"type": "string",
"title": "Expiration Date",
"format": "date-time"
},
"renewalEligibility": {
"icon": "DefaultProperty",
"title": "Renewal Eligibility",
"type": "string",
"enum": [
"ELIGIBLE",
"INELIGIBLE"
],
"enumColors": {
"ELIGIBLE": "green",
"INELIGIBLE": "red"
}
},
"status": {
"icon": "DefaultProperty",
"title": "Status",
"type": "string",
"enum": [
"ISSUED",
"EXPIRED",
"PENDING_VALIDATION",
"INACTIVE",
"FAILED",
"REVOKED",
"VALIDATION_TIMED_OUT"
],
"enumColors": {
"ISSUED": "green",
"EXPIRED": "red",
"PENDING_VALIDATION": "lightGray",
"INACTIVE": "red",
"FAILED": "red",
"REVOKED": "gold",
"VALIDATION_TIMED_OUT": "gold"
}
},
"type": {
"icon": "DefaultProperty",
"type": "string",
"title": "Type"
},
"arn": {
"type": "string",
"title": "Arn"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"account": {
"title": "Account",
"target": "awsAccount",
"required": false,
"many": false
}
}
}
  1. Click Save to create the blueprint.

Update the integration mapping​

  1. Go to the Connectors page in Port.
  2. Select the AWS integration.
  3. Add the following YAML block into the editor to ingest ACM certificates from your AWS account:
AWS integration configuration (click to expand)
deleteDependentEntities: true
createMissingRelatedEntities: true
enableMergeEntity: true
resources:
- kind: AWS::Organizations::Account
selector:
query: 'true'
port:
entity:
mappings:
identifier: .Id
title: .Name
blueprint: '"awsAccount"'
properties:
arn: .Arn
email: .Email
status: .Status
joined_method: .JoinedMethod
joined_timestamp: .JoinedTimestamp | sub(" "; "T")
- kind: AWS::ACM::Certificate
selector:
query: 'true'
port:
entity:
mappings:
identifier: .CertificateArn
title: .DomainName
blueprint: '"acmCertificate"'
properties:
status: .Status
type: .Type
arn: .CertificateArn
renewalEligibility: .RenewalEligibility
keyAlgorithm: .KeyAlgorithm
inUse: .InUse
createdAt: .CreatedAt
expirationDate: .NotAfter
relations:
account: .__AccountId
  1. Click Save & Resync to apply the mapping.

Set up workflows​

We will create workflows in Port that dispatch GitHub Actions through your installed GitHub Ocean integration. These workflows let users:

  1. Request a new ACM certificate.
  2. Renew an eligible ACM certificate.
  3. Delete an ACM certificate.

The renew and delete workflows use an entity-context self-service trigger so they appear both on the Self-service page and in the bolt (⚡) menu on acmCertificate entities. The request workflow is a global self-service form (create flow) because it does not target an existing certificate.

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 - AWS region (for example, us-east-1).
Required permissions

The AWS IAM user must have the acm:RequestCertificate, acm:RenewCertificate, and acm:DeleteCertificate permissions.

Keep these repository secrets configured before creating the Port workflows.

Secrets and integration actions

Secrets are not supported in INTEGRATION_ACTION nodes. GitHub authentication uses your installed GitHub Ocean integration. Keep AWS credentials in GitHub repository secrets, not in the Port workflow JSON.

Request a new ACM certificate​

To request a new ACM certificate from Port, first add a GitHub Actions workflow that requests the certificate in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/request-acm-cert.yaml in the .github/workflows folder of your repository.

Request ACM Certificate GitHub workflow (click to expand)
name: Request ACM Certificate

on:
workflow_dispatch:
inputs:
domain_name:
required: true
description: 'The fully qualified domain name (FQDN) that you want to secure with an ACM certificate'
type: string
validation_method:
required: true
description: 'The method you want to use to validate that you own or control domain'
type: string

jobs:
request-acm:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Request ACM certificate
run: aws acm request-certificate --domain-name ${{ inputs.domain_name }} --validation-method ${{ inputs.validation_method }}
Create Port workflow
  1. Go to the Workflows page in Port.
  2. Click on the + Workflow button in the top-right corner.
  3. In the Name field, enter Request ACM Certificate, then click Confirm.
  4. On the editor page, click the see workflow JSON button (the code icon) to open the JSON editor.
  5. Copy and paste the workflow JSON below to replace the example workflow, then click Save.
Request ACM Certificate workflow (click to expand)
Replace the placeholders
  • <GITHUB-ORG> - your GitHub organization or user name.
  • <GITHUB-REPO> - your GitHub repository name.
  • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID from the Connectors page.
{
"identifier": "request_acm_certificate",
"title": "Request ACM Certificate",
"icon": "AWS",
"description": "Requests an ACM certificate for use with other Amazon Web Services services",
"nodes": [
{
"identifier": "trigger",
"config": {
"type": "SELF_SERVE_TRIGGER",
"userInputs": {
"properties": {
"domain_name": {
"icon": "DefaultProperty",
"type": "string",
"title": "Domain Name",
"description": "The fully qualified domain name (FQDN), such as www.example.com, that you want to secure with an ACM certificate"
},
"validation_method": {
"icon": "DefaultProperty",
"title": "Validation Method",
"description": "The method you want to use if you are requesting a public certificate to validate that you own or control domain",
"type": "string",
"default": "DNS",
"enum": [
"EMAIL",
"DNS"
],
"enumColors": {
"EMAIL": "lightGray",
"DNS": "lightGray"
}
}
},
"required": [
"domain_name",
"validation_method"
],
"order": [
"domain_name",
"validation_method"
]
}
}
},
{
"identifier": "dispatch_request",
"title": "Request ACM certificate",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB-ORG>",
"repo": "<GITHUB-REPO>",
"workflow": "request-acm-cert.yaml",
"workflowInputs": {
"domain_name": "{{ .outputs.trigger.domain_name }}",
"validation_method": "{{ .outputs.trigger.validation_method }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_request"
}
]
}

You can run Request ACM Certificate from the Self-service page.

Renew an ACM certificate​

To renew an ACM certificate from Port, first add a GitHub Actions workflow that renews eligible certificates in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/renew-acm-cert.yaml in the .github/workflows folder of your repository.

Renew ACM Certificate GitHub workflow (click to expand)
name: Renew ACM Certificate

on:
workflow_dispatch:
inputs:
port_context:
required: true
description: 'Port workflow context (entity)'
type: string

jobs:
renew-acm-cert:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Renew ACM certificate
run: aws acm renew-certificate --certificate-arn ${{ fromJson(inputs.port_context).entity.properties.arn }}
Create Port workflow
  1. Go to the Workflows page in Port.
  2. Click on the + Workflow button in the top-right corner.
  3. In the Name field, enter Renew ACM Certificate, then click Confirm.
  4. On the editor page, click the see workflow JSON button (the code icon) to open the JSON editor.
  5. Copy and paste the workflow JSON below to replace the example workflow, then click Save.
Renew ACM Certificate workflow (click to expand)
Replace the placeholders
  • <GITHUB-ORG> - your GitHub organization or user name.
  • <GITHUB-REPO> - your GitHub repository name.
  • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID from the Connectors page.
{
"identifier": "renew_acm_certificate",
"title": "Renew ACM Certificate",
"icon": "AWS",
"description": "Renews an eligible ACM certificate",
"nodes": [
{
"identifier": "trigger",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "acm_certificate"
}
],
"userInputs": {
"properties": {
"acm_certificate": {
"title": "ACM Certificate",
"type": "string",
"format": "entity",
"blueprint": "acmCertificate",
"icon": "AWS",
"dataset": {
"combinator": "and",
"rules": [
{
"property": "renewalEligibility",
"operator": "=",
"value": "ELIGIBLE"
}
]
}
}
},
"required": [
"acm_certificate"
],
"order": [
"acm_certificate"
]
}
}
},
{
"identifier": "fetch_certificate",
"title": "Fetch ACM certificate",
"icon": "AWS",
"config": {
"type": "WEBHOOK",
"url": "https://api.port.io/v1/blueprints/acmCertificate/entities/{{ .outputs.trigger.acm_certificate | @uri }}",
"method": "GET",
"synchronized": true
},
"variables": {
"entity": "{{ .result.response.data.entity }}"
}
},
{
"identifier": "dispatch_renew",
"title": "Renew ACM certificate",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB-ORG>",
"repo": "<GITHUB-REPO>",
"workflow": "renew-acm-cert.yaml",
"workflowInputs": {
"port_context": {
"entity": "{{ .outputs.fetch_certificate.entity }}"
}
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "fetch_certificate"
},
{
"sourceIdentifier": "fetch_certificate",
"targetIdentifier": "dispatch_renew"
}
]
}

You can run Renew ACM Certificate from Self-service or from the bolt menu on an eligible acmCertificate entity.

Eligible certificates only

The renew workflow entity picker is filtered to certificates with renewalEligibility set to ELIGIBLE, so users can only renew certificates that AWS marks as eligible.

Delete an ACM certificate​

To delete an ACM certificate from Port, first add a GitHub Actions workflow that deletes the certificate in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/delete-acm-cert.yaml in the .github/workflows folder of your repository.

Delete ACM Certificate GitHub workflow (click to expand)
name: Delete ACM Certificate

on:
workflow_dispatch:
inputs:
port_context:
required: true
description: 'Port workflow context (entity)'
type: string

jobs:
delete-acm-cert:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Delete ACM certificate
run: aws acm delete-certificate --certificate-arn ${{ fromJson(inputs.port_context).entity.properties.arn }}
Create Port workflow
  1. Go to the Workflows page in Port.
  2. Click on the + Workflow button in the top-right corner.
  3. In the Name field, enter Delete ACM Certificate, then click Confirm.
  4. On the editor page, click the see workflow JSON button (the code icon) to open the JSON editor.
  5. Copy and paste the workflow JSON below to replace the example workflow, then click Save.
Delete ACM Certificate workflow (click to expand)
Replace the placeholders
  • <GITHUB-ORG> - your GitHub organization or user name.
  • <GITHUB-REPO> - your GitHub repository name.
  • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID from the Connectors page.
{
"identifier": "delete_acm_certification",
"title": "Delete ACM Certificate",
"icon": "AWS",
"description": "Deletes a certificate and its associated private key.",
"nodes": [
{
"identifier": "trigger",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "acm_certificate"
}
],
"userInputs": {
"properties": {
"acm_certificate": {
"title": "ACM Certificate",
"type": "string",
"format": "entity",
"blueprint": "acmCertificate",
"icon": "AWS"
}
},
"required": [
"acm_certificate"
],
"order": [
"acm_certificate"
]
}
}
},
{
"identifier": "fetch_certificate",
"title": "Fetch ACM certificate",
"icon": "AWS",
"config": {
"type": "WEBHOOK",
"url": "https://api.port.io/v1/blueprints/acmCertificate/entities/{{ .outputs.trigger.acm_certificate | @uri }}",
"method": "GET",
"synchronized": true
},
"variables": {
"entity": "{{ .result.response.data.entity }}"
}
},
{
"identifier": "dispatch_delete",
"title": "Delete ACM certificate",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB-ORG>",
"repo": "<GITHUB-REPO>",
"workflow": "delete-acm-cert.yaml",
"workflowInputs": {
"port_context": {
"entity": "{{ .outputs.fetch_certificate.entity }}"
}
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "fetch_certificate"
},
{
"sourceIdentifier": "fetch_certificate",
"targetIdentifier": "dispatch_delete"
}
]
}

You can run Delete ACM Certificate from Self-service or from the bolt menu on an acmCertificate entity.

Data loss risk

Deleting an ACM certificate permanently removes the certificate and its associated private key. This operation cannot be undone.

Visualize certificate metrics​

With your data and workflows in place, we can create a dedicated dashboard in Port to visualize all ACM certificates by status, usage, and expiration. In addition, we can trigger workflows (request, renew, delete) directly from the dashboard.

Create a dashboard​

  1. Go to your context lake.
  2. Click on the + button in the left sidebar.
  3. Select New dashboard.
  4. Name the dashboard ACM Certificate Management.
  5. Input Monitor and manage your AWS ACM certificates under Description.
  6. Select the AWS icon.
  7. Click Create.

We now have a blank dashboard where we can start adding widgets to visualize insights from our AWS ACM certificates.

Add widgets​

In the new dashboard, create the following widgets:

Certificates not in use (click to expand)
  1. Click + Widget and select Number Chart.
  2. Title: Certificates not in use (add the AWS icon).
  3. Select Count entities Chart type and choose ACM Certificate as the Blueprint.
  4. Select count for the Function.
  5. Add this JSON to the Additional filters editor to filter certificates not in use:
[
{
"combinator":"and",
"rules":[
{
"property":"inUse",
"operator":"=",
"value": false
}
]
}
]
  1. Select custom as the Unit and input certificates as the Custom unit.
  2. Click Save.
Certificates by status (click to expand)
  1. Click + Widget and select Pie chart.
  2. Title: Certificates by status (add the AWS icon).
  3. Choose the ACM Certificate blueprint.
  4. Under Breakdown by property, select the Status property.
  5. Click Save.
Expired certificates table (click to expand)
  1. Click + Widget and select Table.
  2. Title: Expired certificates (add the AWS icon).
  3. Choose the ACM Certificate blueprint.
  4. Add this JSON to the Additional filters editor to filter expired certificates:
{
"combinator":"and",
"rules":[
{
"operator":"=",
"value":"acmCertificate",
"property":"$blueprint"
},
{
"operator":"=",
"value":"EXPIRED",
"property":"status"
}
]
}
  1. Click Save to add the widget to the dashboard.
  2. Click on the ... button in the top right corner of the table and select Customize table.
  3. In the top right corner of the table, click on Manage Properties and add the following properties:
    • Title: The certificate domain name.
    • Status: The current status of the certificate.
    • Expiration Date: When the certificate expired.
    • Account: The name of each related AWS account.
    • In Use: Whether the certificate is currently in use.
  4. Click on the save icon in the top right corner of the widget to save the customized table.
Request new certificate workflow (click to expand)
  1. Click + Widget and select Action card.
  2. Choose the Request ACM Certificate workflow we created in this guide.
  3. Click Save.

AWS Auto Scaling Groups​

Use this section to bring your AWS Auto Scaling Group management experience into Port using workflows.

In this section, you will:

  • Ingest Auto Scaling Group data into Port's context lake using Port's AWS integration.
  • Set up workflows to scale Auto Scaling Groups up, down, to max, or to min, and to resize them.

Prerequisites

This section assumes the following:

  • You have a Port account and have completed the onboarding process.
  • Port's AWS integration is installed in your account.
  • GitHub Ocean is installed in your account.
  • You have access to a GitHub repository for storing the GitHub Actions workflow files used by the Port workflows.
Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

AWS Auto Scaling Groups dashboard with scale workflow

Set up data model​

When installing the AWS integration in Port, the AWS Account blueprint is created by default. However, the Auto Scaling Group blueprint is not created automatically, so we will create it manually.

Create the Auto Scaling Group blueprint​

  1. Go to the Data model page in Port.

  2. Click on + Blueprint.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration:

AWS Auto Scaling Group blueprint (click to expand)
{
"identifier": "autoScalingGroup",
"description": "This blueprint represents an AWS Auto Scaling Group in our context lake",
"title": "Auto Scaling Group",
"icon": "AWS",
"schema": {
"properties": {
"link": {
"type": "string",
"format": "url",
"title": "Link"
},
"desiredCapacity": {
"type": "number",
"title": "Desired Capacity"
},
"minSize": {
"type": "number",
"title": "Minimum Size"
},
"maxSize": {
"type": "number",
"title": "Maximum Size"
},
"arn": {
"type": "string",
"title": "ARN"
},
"role": {
"type": "string",
"format": "url",
"title": "Service Linked Role ARN"
},
"tags": {
"items": {
"type": "object"
},
"type": "array",
"title": "Tags"
},
"region": {
"type": "string",
"title": "Region"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"account": {
"title": "Account",
"target": "awsAccount",
"required": true,
"many": false
}
}
}
  1. Click Save to create the blueprint.

Update the integration mapping​

  1. Go to the Connectors page in Port.
  2. Select the AWS integration.
  3. Add the following YAML block into the editor to ingest Auto Scaling Groups from your AWS account:
AWS integration configuration (click to expand)
deleteDependentEntities: true
createMissingRelatedEntities: true
enableMergeEntity: true
resources:
- kind: AWS::Organizations::Account
selector:
query: 'true'
port:
entity:
mappings:
identifier: .Id
title: .Name
blueprint: '"awsAccount"'
properties:
arn: .Arn
email: .Email
status: .Status
joined_method: .JoinedMethod
joined_timestamp: .JoinedTimestamp | sub(" "; "T")
- kind: AWS::AutoScaling::AutoScalingGroup
selector:
query: 'true'
useGetResourceAPI: 'true'
port:
entity:
mappings:
identifier: .Identifier
title: .Properties.AutoScalingGroupName
blueprint: '"autoScalingGroup"'
properties:
link: ("https://console.aws.amazon.com/ec2/home?region=" + .__Region + "#AutoScalingGroupDetails:id=" + .Properties.AutoScalingGroupName + ";view=details" | tostring)
desiredCapacity: .Properties.DesiredCapacity
minSize: .Properties.MinSize
maxSize: .Properties.MaxSize
arn: .Properties.AutoScalingGroupARN
role: ("https://console.aws.amazon.com/go/view?arn=" + .Properties.ServiceLinkedRoleARN | tostring)
tags: .Properties.Tags
region: .__Region
relations:
account: .__AccountId
  1. Click Save & Resync to apply the mapping.

Set up workflows​

We will create workflows in Port that dispatch GitHub Actions through your installed GitHub Ocean integration. These workflows let users:

  1. Scale an Auto Scaling Group with predefined operations based on its current capacity and limits.
  2. Resize an Auto Scaling Group by setting its minimum, maximum, and desired capacity.

Each workflow uses an entity-context self-service trigger so it appears both on the Self-service page and in the bolt (⚡) menu on autoScalingGroup entities.

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 - AWS region (for example, us-east-1).
Required permissions

The AWS IAM user must have the autoscaling:UpdateAutoScalingGroup permission.

Keep these repository secrets configured before creating the Port workflows.

Secrets and integration actions

Secrets are not supported in INTEGRATION_ACTION nodes. GitHub authentication uses your installed GitHub Ocean integration. Keep AWS credentials in GitHub repository secrets, not in the Port workflow JSON.

Scale an Auto Scaling Group​

To scale an Auto Scaling Group from Port, first add a GitHub Actions workflow that updates the desired capacity in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/scale-autoscaling-group.yaml in the .github/workflows folder of your repository.

Scale Auto Scaling Group GitHub workflow (click to expand)
name: Scale Auto Scaling Group

on:
workflow_dispatch:
inputs:
operation:
description: 'scale up | scale down | scale to max | scale to min'
required: true
type: string
asg_name:
description: 'Auto Scaling Group name'
required: true
type: string
current_desired:
description: 'Current desired capacity (from Port)'
required: true
type: string
min_size:
description: 'Current minimum size (from Port)'
required: true
type: string
max_size:
description: 'Current maximum size (from Port)'
required: true
type: string

jobs:
scale-autoscaling-group:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Scale Auto Scaling Group
env:
OPERATION: ${{ inputs.operation }}
ASG_NAME: ${{ inputs.asg_name }}
CURRENT_DESIRED: ${{ inputs.current_desired }}
MIN_SIZE: ${{ inputs.min_size }}
MAX_SIZE: ${{ inputs.max_size }}
run: |
case "$OPERATION" in
"scale up") NEW_DESIRED=$((CURRENT_DESIRED + 1)) ;;
"scale down") NEW_DESIRED=$((CURRENT_DESIRED - 1)) ;;
"scale to max") NEW_DESIRED=$MAX_SIZE ;;
"scale to min") NEW_DESIRED=$MIN_SIZE ;;
*) echo "Unknown operation: $OPERATION"; exit 1 ;;
esac

if [ "$NEW_DESIRED" -lt "$MIN_SIZE" ]; then
echo "Cannot scale below minimum size $MIN_SIZE"
exit 1
fi

if [ "$NEW_DESIRED" -gt "$MAX_SIZE" ]; then
echo "Desired capacity $NEW_DESIRED exceeds max size $MAX_SIZE. Raising max size as well."
aws autoscaling update-auto-scaling-group \
--auto-scaling-group-name "$ASG_NAME" \
--desired-capacity "$NEW_DESIRED" \
--max-size "$NEW_DESIRED"
else
aws autoscaling update-auto-scaling-group \
--auto-scaling-group-name "$ASG_NAME" \
--desired-capacity "$NEW_DESIRED"
fi
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Scale Auto Scaling Group workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "scale_auto_scaling_group",
"title": "Scale Auto Scaling Group",
"icon": "AWS",
"description": "Scale an AWS Auto Scaling Group up or down by one instance, or to its minimum or maximum size. Use when a user asks to scale an Auto Scaling Group. Requires the Auto Scaling Group entity and an operation.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Scale Auto Scaling Group",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "auto_scaling_group"
}
],
"userInputs": {
"properties": {
"auto_scaling_group": {
"title": "Auto Scaling Group",
"description": "The Auto Scaling Group to scale",
"type": "string",
"format": "entity",
"blueprint": "autoScalingGroup",
"icon": "AWS"
},
"operation": {
"type": "string",
"title": "Operation",
"description": "One of: scale up, scale down, scale to max, scale to min",
"enum": [
"scale up",
"scale down",
"scale to max",
"scale to min"
],
"enumColors": {
"scale up": "lightGray",
"scale down": "lightGray",
"scale to max": "lightGray",
"scale to min": "lightGray"
}
}
},
"required": [
"auto_scaling_group",
"operation"
],
"order": [
"auto_scaling_group",
"operation"
]
}
}
},
{
"identifier": "fetch_asg",
"title": "Fetch Auto Scaling Group",
"icon": "AWS",
"config": {
"type": "WEBHOOK",
"url": "https://api.port.io/v1/blueprints/autoScalingGroup/entities/{{ .outputs.trigger.auto_scaling_group | @uri }}",
"method": "GET",
"synchronized": true
},
"variables": {
"name": "{{ .result.response.data.entity.title }}",
"desired": "{{ .result.response.data.entity.properties.desiredCapacity | tostring }}",
"min": "{{ .result.response.data.entity.properties.minSize | tostring }}",
"max": "{{ .result.response.data.entity.properties.maxSize | tostring }}"
}
},
{
"identifier": "dispatch_scale",
"title": "Scale Auto Scaling Group",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "scale-autoscaling-group.yaml",
"workflowInputs": {
"operation": "{{ .outputs.trigger.operation }}",
"asg_name": "{{ .outputs.fetch_asg.name }}",
"current_desired": "{{ .outputs.fetch_asg.desired }}",
"min_size": "{{ .outputs.fetch_asg.min }}",
"max_size": "{{ .outputs.fetch_asg.max }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "fetch_asg"
},
{
"sourceIdentifier": "fetch_asg",
"targetIdentifier": "dispatch_scale"
}
]
}

You can run Scale Auto Scaling Group from Self-service or from the bolt menu on an autoScalingGroup entity.

Predefined scaling operations

The workflow provides four simple scaling operations that automatically calculate the appropriate desired capacity based on the Auto Scaling Group's current configuration and limits.

Resize an Auto Scaling Group​

This workflow updates the minimum, maximum, and desired capacity of an Auto Scaling Group.

Add GitHub workflow

Create the file .github/workflows/resize-asg.yaml in the .github/workflows folder of your repository.

Resize Auto Scaling Group GitHub workflow (click to expand)
name: Resize Auto Scaling Group

on:
workflow_dispatch:
inputs:
asg_name:
description: 'Auto Scaling Group name (Port entity identifier)'
required: true
type: string
minimum_capacity:
description: 'Minimum size of the Auto Scaling Group'
required: true
type: string
maximum_capacity:
description: 'Maximum size of the Auto Scaling Group'
required: true
type: string
desired_capacity:
description: 'New desired capacity'
required: true
type: string

jobs:
resize-asg:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Resize Auto Scaling Group
env:
ASG_NAME: ${{ inputs.asg_name }}
MIN_SIZE: ${{ inputs.minimum_capacity }}
MAX_SIZE: ${{ inputs.maximum_capacity }}
DESIRED: ${{ inputs.desired_capacity }}
run: |
if [ "$MIN_SIZE" -gt "$MAX_SIZE" ] || [ "$DESIRED" -lt "$MIN_SIZE" ] || [ "$DESIRED" -gt "$MAX_SIZE" ]; then
echo "Invalid sizes: require minimum <= desired <= maximum (got min=$MIN_SIZE desired=$DESIRED max=$MAX_SIZE)"
exit 1
fi
aws autoscaling update-auto-scaling-group \
--auto-scaling-group-name "$ASG_NAME" \
--min-size "$MIN_SIZE" \
--max-size "$MAX_SIZE" \
--desired-capacity "$DESIRED"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Resize Auto Scaling Group workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "resize_auto_scaling_group",
"title": "Resize Auto Scaling Group",
"icon": "AWS",
"description": "Set the minimum, maximum, and desired capacity of an AWS Auto Scaling Group. Use when a user asks to resize an Auto Scaling Group to specific values. Requires the Auto Scaling Group entity and the three capacity values.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Resize Auto Scaling Group",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "auto_scaling_group"
}
],
"userInputs": {
"properties": {
"auto_scaling_group": {
"title": "Auto Scaling Group",
"description": "The Auto Scaling Group to resize",
"type": "string",
"format": "entity",
"blueprint": "autoScalingGroup",
"icon": "AWS"
},
"minimum_capacity": {
"icon": "DefaultProperty",
"title": "Minimum capacity",
"description": "Minimum number of instances",
"type": "number",
"default": 1,
"minimum": 0
},
"maximum_capacity": {
"icon": "DefaultProperty",
"title": "Maximum capacity",
"description": "Maximum number of instances",
"type": "number",
"default": 1,
"minimum": 1
},
"desired_capacity": {
"title": "Desired capacity",
"description": "Desired number of instances, between the minimum and maximum",
"type": "number",
"default": 1,
"minimum": 0
}
},
"required": [
"auto_scaling_group",
"minimum_capacity",
"maximum_capacity",
"desired_capacity"
],
"order": [
"auto_scaling_group",
"minimum_capacity",
"maximum_capacity",
"desired_capacity"
]
}
}
},
{
"identifier": "dispatch_resize",
"title": "Resize Auto Scaling Group",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "resize-asg.yaml",
"workflowInputs": {
"asg_name": "{{ .outputs.trigger.auto_scaling_group }}",
"minimum_capacity": "{{ .outputs.trigger.minimum_capacity | tostring }}",
"maximum_capacity": "{{ .outputs.trigger.maximum_capacity | tostring }}",
"desired_capacity": "{{ .outputs.trigger.desired_capacity | tostring }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_resize"
}
]
}

You can run Resize Auto Scaling Group from Self-service or from the bolt menu on an autoScalingGroup entity.

AWS SQS queues​

Use this section to bring your AWS SQS management experience into Port using workflows.

In this section, we will:

  • Ingest SQS queue data into Port's context lake using Port's AWS integration.
  • Set up workflows to manage SQS queues (purge, redrive, and delete).
  • Build dashboards in Port to monitor and take action on your SQS resources.

Prerequisites

This section assumes the following:

  • You have a Port account and have completed the onboarding process.
  • Access to the workflows beta feature.
  • Port's AWS integration is installed in your account.
  • GitHub Ocean is installed in your account.
  • You have access to a GitHub repository for storing the GitHub Actions workflow files used by the Port workflows.
Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

SQS Queue Manager dashboard with metrics SQS queues table with day-2 workflows menu

Set up data model​

When installing the AWS integration in Port, the AWS Account blueprint is created by default. However, the SQS Queue blueprint is not created automatically, so we will create it manually.

Create the SQS queue blueprint​

  1. Go to the Builder page in Port.
  2. Click on + Blueprint.
  3. Click on the {...} button in the top right corner, and choose Edit JSON.
  4. Add this JSON schema:
AWS SQS Queue blueprint (click to expand)
{
"identifier": "sqs",
"description": "This blueprint represents an AWS SQS service in our context lake",
"title": "SQS Queue",
"icon": "AWS",
"schema": {
"properties": {
"link": {
"type": "string",
"format": "url",
"title": "Link"
},
"visibilityTimeout": {
"type": "number",
"title": "Visibility Timeout"
},
"messageRetentionPeriod": {
"type": "number",
"title": "Message Retention Period"
},
"maximumMessageSize": {
"type": "number",
"title": "Maximum Message Size"
},
"receiveMessageWaitTimeSeconds": {
"type": "number",
"title": "Receive Message Wait Time"
},
"delaySeconds": {
"type": "number",
"title": "Delay Seconds"
},
"tags": {
"type": "array",
"title": "Tags"
},
"arn": {
"type": "string",
"title": "ARN"
},
"sseEnabled": {
"type": "boolean",
"title": "SSE Enabled"
},
"dlqRedrivePolicy": {
"icon": "DefaultProperty",
"type": "object",
"title": "Dead Letter Queue Policy"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"account": {
"title": "Account",
"target": "awsAccount",
"required": true,
"many": false
}
}
}
  1. Click Save to create the blueprint.

Update the integration mapping​

  1. Go to the Connectors page in Port.
  2. Select the AWS integration.
  3. Add the following YAML block into the editor to ingest SQS queues from your AWS account:
AWS integration configuration (click to expand)
deleteDependentEntities: true
createMissingRelatedEntities: true
enableMergeEntity: true
resources:
- kind: AWS::Organizations::Account
selector:
query: 'true'
port:
entity:
mappings:
identifier: .Id
title: .Name
blueprint: '"awsAccount"'
properties:
arn: .Arn
email: .Email
status: .Status
joined_method: .JoinedMethod
joined_timestamp: .JoinedTimestamp | sub(" "; "T")
- kind: AWS::SQS::Queue
selector:
query: 'true'
port:
entity:
mappings:
identifier: .__Region + "-" + .__AccountId + "-" + .Properties.QueueName
title: .Properties.QueueName
blueprint: '"sqs"'
properties:
link: .Properties.QueueUrl
visibilityTimeout: .Properties.VisibilityTimeout
messageRetentionPeriod: .Properties.MessageRetentionPeriod
maximumMessageSize: .Properties.MaximumMessageSize
receiveMessageWaitTimeSeconds: .Properties.ReceiveMessageWaitTimeSeconds
delaySeconds: .Properties.DelaySeconds
tags: .Properties.Tags
arn: .Properties.Arn
sseEnabled: .Properties.SqsManagedSseEnabled
dlqRedrivePolicy: .Properties.RedrivePolicy
relations:
account: .__AccountId
  1. Click Save & Resync to apply the mapping.

Set up workflows​

We will create workflows in Port that dispatch GitHub Actions through your installed GitHub Ocean integration. These workflows let users:

  1. Purge an SQS queue.
  2. Redrive messages from a dead-letter queue (DLQ).
  3. Delete an SQS queue.

The purge, redrive, and delete workflows use an entity-context self-service trigger so they appear both on the Self-service page and in the bolt (⚡) menu on sqs entities.

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 - AWS region (for example, us-east-1).
Required permissions

The AWS IAM user must have the sqs:PurgeQueue, sqs:StartMessageMoveTask, and sqs:DeleteQueue permissions.

Keep these repository secrets configured before creating the Port workflows.

Secrets and integration actions

Secrets are not supported in INTEGRATION_ACTION nodes. GitHub authentication uses your installed GitHub Ocean integration. Keep AWS credentials in GitHub repository secrets, not in the Port workflow JSON.

Purge an SQS queue​

To purge an SQS queue from Port, first add a GitHub Actions workflow that purges the queue in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/purge-queue.yaml in the .github/workflows folder of your repository.

Purge SQS Queue GitHub workflow (click to expand)
name: Purge SQS Queue

on:
workflow_dispatch:
inputs:
port_context:
required: true
description: 'Port workflow context (entity)'
type: string

jobs:
purge-queue:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Purge SQS queue
run: aws sqs purge-queue --queue-url ${{ fromJson(inputs.port_context).entity.properties.link }}
Create Port workflow
  1. Go to the Workflows page in Port.
  2. Click on the + Workflow button in the top-right corner.
  3. In the Name field, enter Purge Queue, then click Confirm.
  4. On the editor page, click the see workflow JSON button (the code icon) to open the JSON editor.
  5. Copy and paste the workflow JSON below to replace the example workflow, then click Save.
Purge Queue workflow (click to expand)
Replace the placeholders
  • <GITHUB-ORG> - your GitHub organization or user name.
  • <GITHUB-REPO> - your GitHub repository name.
  • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID from the Connectors page.
{
"identifier": "purge_sqs_queue",
"title": "Purge Queue",
"icon": "SNS",
"description": "Delete available messages in an SQS queue",
"nodes": [
{
"identifier": "trigger",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "sqs_queue"
}
],
"userInputs": {
"properties": {
"sqs_queue": {
"title": "SQS Queue",
"type": "string",
"format": "entity",
"blueprint": "sqs",
"icon": "AWS"
}
},
"required": [
"sqs_queue"
],
"order": [
"sqs_queue"
]
}
}
},
{
"identifier": "fetch_queue",
"title": "Fetch SQS queue",
"icon": "AWS",
"config": {
"type": "WEBHOOK",
"url": "https://api.port.io/v1/blueprints/sqs/entities/{{ .outputs.trigger.sqs_queue | @uri }}",
"method": "GET",
"synchronized": true
},
"variables": {
"entity": "{{ .result.response.data.entity }}"
}
},
{
"identifier": "dispatch_purge",
"title": "Purge SQS queue",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB-ORG>",
"repo": "<GITHUB-REPO>",
"workflow": "purge-queue.yaml",
"workflowInputs": {
"port_context": {
"entity": "{{ .outputs.fetch_queue.entity }}"
}
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "fetch_queue"
},
{
"sourceIdentifier": "fetch_queue",
"targetIdentifier": "dispatch_purge"
}
]
}

You can run Purge Queue from Self-service or from the bolt menu on an sqs entity.

Data loss risk

Purging an SQS queue permanently deletes all available messages in the queue. This operation cannot be undone.

Redrive messages from a DLQ​

To redrive messages from a dead-letter queue from Port, first add a GitHub Actions workflow that starts the redrive operation in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/redrive-queue.yaml in the .github/workflows folder of your repository.

Redrive DLQ GitHub workflow (click to expand)
name: Redrive DLQ Messages

on:
workflow_dispatch:
inputs:
source_queue:
description: 'The source queue ARN'
required: true
type: string
destination_queue:
description: 'The destination queue ARN'
required: true
type: string
max_messages_per_second:
description: 'Max number of messages per second'
required: true
type: string

jobs:
redrive-queue:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Redrive DLQ messages
run: aws sqs start-message-move-task --source-arn ${{ inputs.source_queue }} --destination-arn ${{ inputs.destination_queue }} --max-number-of-messages-per-second ${{ inputs.max_messages_per_second }}
Create Port workflow
  1. Go to the Workflows page in Port.
  2. Click on the + Workflow button in the top-right corner.
  3. In the Name field, enter Redrive Queue, then click Confirm.
  4. On the editor page, click the see workflow JSON button (the code icon) to open the JSON editor.
  5. Copy and paste the workflow JSON below to replace the example workflow, then click Save.
Redrive Queue workflow (click to expand)
Replace the placeholders
  • <GITHUB-ORG> - your GitHub organization or user name.
  • <GITHUB-REPO> - your GitHub repository name.
  • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID from the Connectors page.
{
"identifier": "redrive_queue",
"title": "Redrive Queue",
"icon": "SNS",
"description": "Start an asynchronous task to move messages from a source queue to a destination queue",
"nodes": [
{
"identifier": "trigger",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "sqs_queue"
}
],
"userInputs": {
"properties": {
"sqs_queue": {
"title": "Source Queue",
"type": "string",
"format": "entity",
"blueprint": "sqs",
"icon": "AWS",
"description": "The dead-letter queue to move messages from"
},
"destination_queue": {
"title": "Destination Queue",
"type": "string",
"format": "entity",
"blueprint": "sqs",
"icon": "AWS",
"description": "The queue that should receive the redriven messages"
},
"max_messages_per_second": {
"type": "number",
"title": "Max Messages Per Second",
"default": 100,
"maximum": 500
}
},
"required": [
"sqs_queue",
"destination_queue",
"max_messages_per_second"
],
"order": [
"sqs_queue",
"destination_queue",
"max_messages_per_second"
]
}
}
},
{
"identifier": "fetch_source",
"title": "Fetch source queue",
"icon": "AWS",
"config": {
"type": "WEBHOOK",
"url": "https://api.port.io/v1/blueprints/sqs/entities/{{ .outputs.trigger.sqs_queue | @uri }}",
"method": "GET",
"synchronized": true
},
"variables": {
"entity": "{{ .result.response.data.entity }}"
}
},
{
"identifier": "fetch_destination",
"title": "Fetch destination queue",
"icon": "AWS",
"config": {
"type": "WEBHOOK",
"url": "https://api.port.io/v1/blueprints/sqs/entities/{{ .outputs.trigger.destination_queue | @uri }}",
"method": "GET",
"synchronized": true
},
"variables": {
"entity": "{{ .result.response.data.entity }}"
}
},
{
"identifier": "dispatch_redrive",
"title": "Redrive DLQ messages",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB-ORG>",
"repo": "<GITHUB-REPO>",
"workflow": "redrive-queue.yaml",
"workflowInputs": {
"source_queue": "{{ .outputs.fetch_source.entity.properties.arn }}",
"destination_queue": "{{ .outputs.fetch_destination.entity.properties.arn }}",
"max_messages_per_second": "{{ .outputs.trigger.max_messages_per_second | tostring }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "fetch_source"
},
{
"sourceIdentifier": "fetch_source",
"targetIdentifier": "fetch_destination"
},
{
"sourceIdentifier": "fetch_destination",
"targetIdentifier": "dispatch_redrive"
}
]
}

You can run Redrive Queue from Self-service or from the bolt menu on an sqs entity. Select the source (DLQ) and destination queues, then set the max messages per second.

Delete an SQS queue​

To delete an SQS queue from Port, first add a GitHub Actions workflow that deletes the queue in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/delete-queue.yaml in the .github/workflows folder of your repository.

Delete SQS Queue GitHub workflow (click to expand)
name: Delete SQS Queue

on:
workflow_dispatch:
inputs:
port_context:
required: true
description: 'Port workflow context (entity)'
type: string

jobs:
delete-queue:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Delete SQS queue
run: aws sqs delete-queue --queue-url ${{ fromJson(inputs.port_context).entity.properties.link }}
Create Port workflow
  1. Go to the Workflows page in Port.
  2. Click on the + Workflow button in the top-right corner.
  3. In the Name field, enter Delete Queue, then click Confirm.
  4. On the editor page, click the see workflow JSON button (the code icon) to open the JSON editor.
  5. Copy and paste the workflow JSON below to replace the example workflow, then click Save.
Delete Queue workflow (click to expand)
Replace the placeholders
  • <GITHUB-ORG> - your GitHub organization or user name.
  • <GITHUB-REPO> - your GitHub repository name.
  • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID from the Connectors page.
{
"identifier": "delete_queue",
"title": "Delete Queue",
"icon": "SNS",
"description": "Delete an SQS queue",
"nodes": [
{
"identifier": "trigger",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "sqs_queue"
}
],
"userInputs": {
"properties": {
"sqs_queue": {
"title": "SQS Queue",
"type": "string",
"format": "entity",
"blueprint": "sqs",
"icon": "AWS"
}
},
"required": [
"sqs_queue"
],
"order": [
"sqs_queue"
]
}
}
},
{
"identifier": "fetch_queue",
"title": "Fetch SQS queue",
"icon": "AWS",
"config": {
"type": "WEBHOOK",
"url": "https://api.port.io/v1/blueprints/sqs/entities/{{ .outputs.trigger.sqs_queue | @uri }}",
"method": "GET",
"synchronized": true
},
"variables": {
"entity": "{{ .result.response.data.entity }}"
}
},
{
"identifier": "dispatch_delete",
"title": "Delete SQS queue",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB-ORG>",
"repo": "<GITHUB-REPO>",
"workflow": "delete-queue.yaml",
"workflowInputs": {
"port_context": {
"entity": "{{ .outputs.fetch_queue.entity }}"
}
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "fetch_queue"
},
{
"sourceIdentifier": "fetch_queue",
"targetIdentifier": "dispatch_delete"
}
]
}

You can run Delete Queue from Self-service or from the bolt menu on an sqs entity.

Data loss risk

Deleting an SQS queue permanently removes the queue and any messages still in it. This operation cannot be undone.

Visualize metrics​

With your data and workflows in place, we can create a dedicated dashboard in Port to visualize all SQS queues by type, encryption, or DLQ status using customizable widgets. In addition, we can trigger workflows (purge, redrive, delete) directly from the dashboard.

Create a dashboard​

  1. Go to your context lake.
  2. Click on the + button in the left sidebar.
  3. Select New dashboard.
  4. Name the dashboard SQS Management.
  5. Input Purge, redrive or delete SQS queues under Description.
  6. Select the AWS icon.
  7. Click Create.

We now have a blank dashboard where we can start adding widgets to visualize insights from our AWS SQS queues.

Add widgets​

In the new dashboard, create the following widgets:

Total queues (click to expand)
  1. Click + Widget and select Number Chart.
  2. Title: Total queues (add the AWS icon).
  3. Select Count entities Chart type and choose SQS Queue as the Blueprint.
  4. Select count for the Function.
  5. Select custom as the Unit and input queues as the Custom unit. Edit Number Chart for Total queues widget
  6. Click Save.
Queues with DLQ (click to expand)
  1. Click + Widget and select Number Chart.
  2. Title: Queues with DLQ.
  3. Select Count entities Chart type and choose SQS Queue as the Blueprint.
  4. Select count for the Function.
  5. Add this JSON to the Additional filters editor to filter queues with DLQ configuration:
[
{
"combinator":"and",
"rules":[
{
"property":"dlqRedrivePolicy",
"operator":"isNotEmpty"
}
]
}
]
  1. Select custom as the Unit and input queues as the Custom unit. Edit Number Chart for Queues with DLQ
  2. Click Save.
Queues by encryption (click to expand)
  1. Click + Widget and select Pie chart.
  2. Title: Queues by encryption (add the Pie icon).
  3. Choose the SQS Queue blueprint.
  4. Under Breakdown by property, select the SSE Enabled property. Edit Pie Chart for Queues by encryption
  5. Click Save.
SQS queues view (click to expand)
  1. Click + Widget and select Table.
  2. Title the widget All Queues.
  3. Choose the SQS Queue blueprint. Edit table dialog for all SQS queues
  4. Click Save to add the widget to the dashboard.
  5. Click on the ... button in the top right corner of the table and select Customize table.
  6. In the top right corner of the table, click on Manage Properties and add the following properties:
    • Link: The link to the queue.
    • SSE Enabled: Whether the queue has server-side encryption (SSE) enabled.
    • Message Retention Period: The message retention period of the queue.
    • Account: The name of each related AWS account.
  7. Click on the save icon in the top right corner of the widget to save the customized table.

AWS ECS services​

Use this section to bring your AWS ECS management experience into Port.

In this section, you will:

  • Ingest ECS cluster and service data into Port's context lake using Port's AWS integration.
  • Set up self-service actions to manage ECS services (scale, restart, deploy, health check, rollback, and delete).
  • Build dashboards in Port to monitor and take action on your ECS deployments.

Prerequisites

This section assumes the following:

  • You have a Port account and have completed the onboarding process.

  • Port's AWS integration is installed in your account.

  • You have ECS clusters and services running in your AWS account.

  • You have a GitHub integration for running workflows:

  • GitHub Ocean is installed.

ECS Management dashboard with service actions AWS ECS Service table with day-2 operations

Set up data model​

When installing the AWS integration in Port, the AWS Account blueprint is created by default. However, the ECS Cluster and ECS Service blueprints are not created automatically so we will need to create them manually.

Create the AWS ECS Cluster blueprint​

  1. Go to the Data model page in Port.

  2. Click on + Blueprint.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration:

    AWS ECS Cluster blueprint (click to expand)
    {
    "identifier": "awsEcsCluster",
    "title": "AWS ECS Cluster",
    "icon": "AWS",
    "schema": {
    "properties": {
    "link": {
    "type": "string",
    "title": "Link",
    "format": "url",
    "description": "AWS Console link to the cluster"
    },
    "capacityProviders": {
    "type": "array",
    "title": "Capacity Providers",
    "description": "List of capacity providers for the cluster"
    },
    "activeServicesCount": {
    "type": "number",
    "title": "Active Services",
    "description": "Number of active services in the cluster"
    },
    "runningTasksCount": {
    "type": "number",
    "title": "Running Tasks",
    "description": "Number of currently running tasks"
    },
    "pendingTasksCount": {
    "type": "number",
    "title": "Pending Tasks",
    "description": "Number of pending tasks"
    },
    "tags": {
    "type": "array",
    "title": "Tags"
    },
    "arn": {
    "type": "string",
    "title": "ARN"
    }
    },
    "required": []
    },
    "mirrorProperties": {},
    "calculationProperties": {},
    "aggregationProperties": {},
    "relations": {}
    }
  5. Click Save to create the blueprint.

Create the AWS ECS Service blueprint​

  1. Click on + Blueprint again

  2. Click on the {...} Edit JSON button.

  3. Copy and paste the following JSON configuration:

    AWS ECS Service blueprint (click to expand)
    {
    "identifier": "awsEcsService",
    "title": "AWS ECS Service",
    "icon": "AWS",
    "schema": {
    "properties": {
    "link": {
    "type": "string",
    "title": "Link",
    "format": "url",
    "description": "AWS Console link to the service"
    },
    "desiredCount": {
    "type": "number",
    "title": "Desired Count",
    "description": "Desired number of tasks for the service"
    },
    "runningCount": {
    "type": "number",
    "title": "Running Count",
    "description": "Number of tasks currently running"
    },
    "pendingCount": {
    "type": "number",
    "title": "Pending Count",
    "description": "Number of tasks pending"
    },
    "taskDefinition": {
    "type": "string",
    "title": "Task Definition",
    "description": "Task definition used by the service"
    },
    "launchType": {
    "type": "string",
    "title": "Launch Type",
    "enum": ["EC2", "FARGATE", "EXTERNAL"],
    "enumColors": {
    "EC2": "blue",
    "FARGATE": "green",
    "EXTERNAL": "orange"
    }
    },
    "status": {
    "type": "string",
    "title": "Status",
    "enum": ["ACTIVE", "DRAINING", "INACTIVE"],
    "enumColors": {
    "ACTIVE": "green",
    "DRAINING": "yellow",
    "INACTIVE": "red"
    }
    },
    "schedulingStrategy": {
    "type": "string",
    "title": "Scheduling Strategy",
    "enum": ["REPLICA", "DAEMON"]
    },
    "platformVersion": {
    "type": "string",
    "title": "Platform Version"
    },
    "loadBalancers": {
    "type": "array",
    "title": "Load Balancers"
    },
    "arn": {
    "type": "string",
    "title": "ARN"
    },
    "enableExecuteCommand": {
    "type": "boolean",
    "title": "Enable Execute Command"
    },
    "healthCheckGracePeriod": {
    "type": "number",
    "title": "Health Check Grace Prd in sec"
    },
    "deploymentStrategy": {
    "type": "string",
    "title": "Deployment Strategy"
    },
    "maximumPercent": {
    "type": "number",
    "title": "Maximum Percent"
    },
    "minimumHealthyPercent": {
    "type": "number",
    "title": "Minimum Healthy Percent"
    }
    },
    "required": []
    },
    "mirrorProperties": {},
    "calculationProperties": {
    "healthStatus": {
    "title": "Health Status",
    "icon": "DefaultProperty",
    "calculation": ".properties.runningCount == .properties.desiredCount",
    "type": "boolean",
    "colorized": true,
    "colors": {
    "true": "green",
    "false": "red"
    }
    }
    },
    "aggregationProperties": {},
    "relations": {
    "cluster": {
    "title": "Cluster",
    "target": "awsEcsCluster",
    "required": false,
    "many": false
    }
    }
    }
  4. Click Save to create the blueprint.

Update the mapping configuration​

  1. Go to the Connectors page in Port.

  2. Select your AWS integration.

  3. Add the following YAML block into the editor to ingest ECS clusters and services:

    AWS integration configuration (click to expand)
    - kind: AWS::ECS::Cluster
    selector:
    query: 'true'
    useGetResourceAPI: true
    port:
    entity:
    mappings:
    identifier: .Properties.Arn
    title: .Identifier
    blueprint: '"awsEcsCluster"'
    properties:
    link: '"https://console.aws.amazon.com/go/view?arn=" + .Properties.Arn'
    arn: .Properties.Arn
    tags: .Properties.Tags
    - kind: AWS::ECS::Service
    selector:
    query: 'true'
    port:
    entity:
    mappings:
    identifier: .Properties.ServiceArn
    title: .Properties.ServiceName
    blueprint: '"awsEcsService"'
    properties:
    link: '"https://" + .__Region + ".console.aws.amazon.com/ecs/home?region=" + .__Region + "#/clusters/" + .Properties.Cluster + "/services/" + .Properties.ServiceName + "/details"'
    desiredCount: .Properties.DesiredCount
    runningCount: .Properties.RunningCount // 0
    pendingCount: .Properties.PendingCount // 0
    taskDefinition: .Properties.TaskDefinition
    launchType: .Properties.LaunchType
    status: .Properties.Status // "ACTIVE"
    schedulingStrategy: .Properties.SchedulingStrategy
    platformVersion: .Properties.PlatformVersion
    loadBalancers: .Properties.LoadBalancers // []
    arn: .Properties.ServiceArn
    enableExecuteCommand: .Properties.EnableExecuteCommand
    healthCheckGracePeriod: .Properties.HealthCheckGracePeriodSeconds
    deploymentStrategy: .Properties.DeploymentConfiguration.Strategy
    maximumPercent: .Properties.DeploymentConfiguration.MaximumPercent
    minimumHealthyPercent: .Properties.DeploymentConfiguration.MinimumHealthyPercent
    relations:
    cluster: .Properties.Cluster
  4. Click Save & Resync to apply the mapping.

Set up self-service actions​

Now let us create self-service actions to manage your ECS services directly from Port using GitHub Actions. You will implement workflows to:

  1. Scale ECS service tasks up or down.

  2. Restart an ECS service.

  3. Update task definitions with new container images.

  4. Run comprehensive health checks and diagnostics.

  5. Rollback deployments to previous versions.

  6. Safely delete ECS services.

To implement these use-cases, follow the steps below:

Add GitHub secrets

In your GitHub repository, go to Settings > Secrets and add the following secrets:

  • PORT_CLIENT_ID - Port Client ID learn more.
  • PORT_CLIENT_SECRET - Port Client Secret learn more.
  • AWS_ACCESS_KEY_ID - AWS IAM user's access key.
  • AWS_SECRET_ACCESS_KEY - AWS IAM user's secret access key.
  • AWS_REGION - AWS region (e.g., us-east-1).
AWS secrets permission scope

Ensure your AWS credentials have the permissions to ecs:UpdateService, ecs:DescribeServices, ecs:ListServices, and ecs:DescribeClusters.

Scale ECS service​

To scale an ECS service from Port, first add a GitHub workflow that updates the desired task count in AWS. Then create a Port self-service action that triggers the workflow.

Add GitHub workflow

Create the file .github/workflows/scale-ecs-service.yml in the .github/workflows folder of your repository.

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

Scale ECS Service GitHub workflow (click to expand)
name: Scale ECS Service

on:
workflow_dispatch:
inputs:
desired_count:
description: 'New desired task count'
required: true
type: number
port_context:
required: true
description: 'Action and general context (blueprint, run id, etc...)'
type: string

jobs:
scale-ecs-service:
runs-on: ubuntu-latest
steps:
- name: Inform Port about workflow start
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: Configuring AWS credentials and scaling ECS service

- 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: ${{ secrets.AWS_REGION }}

- name: Scale ECS Service
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "Scaling ECS service $SERVICE_ARN in cluster $CLUSTER_NAME to ${{ github.event.inputs.desired_count }} tasks"

aws ecs update-service \
--cluster "$CLUSTER_NAME" \
--service "$SERVICE_ARN" \
--desired-count "${{ github.event.inputs.desired_count }}"

- name: Wait for service to stabilize
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "Waiting for service to reach stable state..."
aws ecs wait services-stable \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN"

- name: Inform Port about successful scaling
if: success()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'SUCCESS'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ✅ Successfully scaled ECS service ${{ fromJson(inputs.port_context).entity.identifier }} to ${{ github.event.inputs.desired_count }} tasks

- name: Inform Port about failed scaling
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'FAILURE'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ❌ Failed to scale ECS service ${{ fromJson(inputs.port_context).entity.identifier }}
Create Port action
  1. Go to the Self-service page in Port.

  2. Click on the + New Action button.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration into the editor.

    Scale ECS Service action (click to expand)
    Replace the variables
    • <GITHUB-ORG> - your GitHub organization or user name.
    • <GITHUB-REPO> - your GitHub repository name.
    • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID.
    {
    "identifier": "scale_ecs_service",
    "title": "Scale ECS Service",
    "icon": "AWS",
    "description": "Scale the desired count of tasks for an ECS service",
    "trigger": {
    "type": "self-service",
    "operation": "DAY-2",
    "userInputs": {
    "properties": {
    "desired_count": {
    "title": "Desired Count",
    "type": "number",
    "description": "Number of tasks to run",
    "minimum": 0,
    "maximum": 100,
    "default": 1
    }
    },
    "required": ["desired_count"],
    "order": ["desired_count"]
    },
    "blueprintIdentifier": "awsEcsService"
    },
    "invocationMethod": {
    "type": "INTEGRATION_ACTION",
    "installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
    "integrationActionType": "dispatch_workflow",
    "integrationActionExecutionProperties": {
    "org": "<GITHUB-ORG>",
    "repo": "<GITHUB-REPO>",
    "workflow": "scale-ecs-service.yml",
    "workflowInputs": {
    "desired_count": "{{.inputs.\"desired_count\"}}",
    "port_context": {
    "entity": "{{ .entity }}",
    "blueprint": "{{ .action.blueprint }}",
    "runId": "{{ .run.id }}",
    "trigger": "{{ .trigger }}"
    }
    },
    "reportWorkflowStatus": true
    }
    },
    "requiredApproval": false
    }
  5. Click Save.

Now you should see the Scale ECS Service action in the self-service page. 🎉

Restart ECS service​

To restart an ECS service from Port, first add a GitHub workflow that forces a new deployment in AWS. Then create a Port self-service action that triggers the workflow.

Add GitHub workflow

Create the file .github/workflows/restart-ecs-service.yml in the .github/workflows folder of your repository.

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

Restart ECS Service GitHub workflow (click to expand)
name: Restart ECS Service

on:
workflow_dispatch:
inputs:
port_context:
required: true
description: 'Action and general context (blueprint, run id, etc...)'
type: string

jobs:
restart-ecs-service:
runs-on: ubuntu-latest
steps:
- name: Inform Port about workflow start
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: Configuring AWS credentials and restarting ECS service

- 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: ${{ secrets.AWS_REGION }}

- name: Force new deployment
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "Forcing new deployment for ECS service $SERVICE_ARN in cluster $CLUSTER_NAME"

aws ecs update-service \
--cluster "$CLUSTER_NAME" \
--service "$SERVICE_ARN" \
--force-new-deployment

- name: Wait for deployment to complete
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "Waiting for deployment to complete..."
aws ecs wait services-stable \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN"

- name: Inform Port about successful restart
if: success()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'SUCCESS'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ✅ Successfully restarted ECS service ${{ fromJson(inputs.port_context).entity.identifier }}

- name: Inform Port about failed restart
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'FAILURE'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ❌ Failed to restart ECS service ${{ fromJson(inputs.port_context).entity.identifier }}
Create Port action
  1. Go to the Self-service page in Port.

  2. Click on the + New Action button.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration into the editor.

    Restart ECS Service action (click to expand)
    Replace the variables
    • <GITHUB-ORG> - your GitHub organization or user name.
    • <GITHUB-REPO> - your GitHub repository name.
    • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID.
    {
    "identifier": "restart_ecs_service",
    "title": "Restart ECS Service",
    "icon": "AWS",
    "description": "Force a new deployment of the ECS service",
    "trigger": {
    "type": "self-service",
    "operation": "DAY-2",
    "userInputs": {
    "properties": {},
    "required": [],
    "order": []
    },
    "blueprintIdentifier": "awsEcsService"
    },
    "invocationMethod": {
    "type": "INTEGRATION_ACTION",
    "installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
    "integrationActionType": "dispatch_workflow",
    "integrationActionExecutionProperties": {
    "org": "<GITHUB-ORG>",
    "repo": "<GITHUB-REPO>",
    "workflow": "restart-ecs-service.yml",
    "workflowInputs": {
    "port_context": {
    "entity": "{{ .entity }}",
    "blueprint": "{{ .action.blueprint }}",
    "runId": "{{ .run.id }}",
    "trigger": "{{ .trigger }}"
    }
    },
    "reportWorkflowStatus": true
    }
    },
    "requiredApproval": false
    }
  5. Click Save.

Now you should see the Restart ECS Service action in the self-service page. 🎉

Update task definition​

To update an ECS task definition from Port, first add a GitHub workflow that registers the new task definition and updates the service. Then create a Port self-service action that triggers the workflow.

Add GitHub workflow

Create the file .github/workflows/update-task-definition.yml in the .github/workflows folder of your repository.

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

Update Task Definition GitHub workflow (click to expand)
name: Update ECS Task Definition

on:
workflow_dispatch:
inputs:
image_uri:
description: 'New container image URI'
required: true
type: string
port_context:
required: true
description: 'Action and general context (blueprint, run id, etc...)'
type: string

jobs:
update-task-definition:
runs-on: ubuntu-latest
steps:
- name: Inform Port about workflow start
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: Configuring AWS credentials and updating task definition

- 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: ${{ secrets.AWS_REGION }}

- name: Get current task definition
id: current-task-def
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

# Get current task definition ARN
TASK_DEF_ARN=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].taskDefinition' \
--output text)

echo "current_task_def_arn=$TASK_DEF_ARN" >> $GITHUB_OUTPUT

# Get task definition details
aws ecs describe-task-definition \
--task-definition "$TASK_DEF_ARN" \
--query 'taskDefinition' > current-task-def.json

- name: Update task definition with new image
id: new-task-def
run: |
# Update the image URI in the task definition
jq --arg new_image "${{ github.event.inputs.image_uri }}" \
'.containerDefinitions[0].image = $new_image |
del(.taskDefinitionArn, .revision, .status, .requiresAttributes, .placementConstraints, .compatibilities, .registeredAt, .registeredBy)' \
current-task-def.json > new-task-def.json

# Register new task definition
NEW_TASK_DEF_ARN=$(aws ecs register-task-definition \
--cli-input-json file://new-task-def.json \
--query 'taskDefinition.taskDefinitionArn' \
--output text)

echo "new_task_def_arn=$NEW_TASK_DEF_ARN" >> $GITHUB_OUTPUT
echo "📝 Registered new task definition: $NEW_TASK_DEF_ARN"

- name: Update service with new task definition
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"
NEW_TASK_DEF_ARN="${{ steps.new-task-def.outputs.new_task_def_arn }}"

echo "🚀 Updating service with new task definition..."

aws ecs update-service \
--cluster "$CLUSTER_NAME" \
--service "$SERVICE_ARN" \
--task-definition "$NEW_TASK_DEF_ARN"

- name: Wait for deployment to complete
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "⏳ Waiting for deployment to complete..."
aws ecs wait services-stable \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN"

- name: Inform Port about successful update
if: success()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'SUCCESS'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ✅ Successfully updated ECS service ${{ fromJson(inputs.port_context).entity.identifier }} with new image ${{ github.event.inputs.image_uri }}

- name: Inform Port about failed update
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'FAILURE'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ❌ Failed to update ECS service ${{ fromJson(inputs.port_context).entity.identifier }}
Create Port action
  1. Go to the Self-service page in Port.

  2. Click on the + New Action button.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration into the editor.

    Update Task Definition action (click to expand)
    Replace the variables
    • <GITHUB-ORG> - your GitHub organization or user name.
    • <GITHUB-REPO> - your GitHub repository name.
    • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID.
    {
    "identifier": "update_task_definition",
    "title": "Update Task Definition",
    "icon": "AWS",
    "description": "Deploy new container image version",
    "trigger": {
    "type": "self-service",
    "operation": "DAY-2",
    "userInputs": {
    "properties": {
    "image_uri": {
    "title": "Container Image URI",
    "type": "string",
    "description": "Full URI of the new container image (e.g., account.dkr.ecr.region.amazonaws.com/repo:tag)",
    "pattern": "^.+:.+$"
    }
    },
    "required": ["image_uri"],
    "order": ["image_uri"]
    },
    "blueprintIdentifier": "awsEcsService"
    },
    "invocationMethod": {
    "type": "INTEGRATION_ACTION",
    "installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
    "integrationActionType": "dispatch_workflow",
    "integrationActionExecutionProperties": {
    "org": "<GITHUB-ORG>",
    "repo": "<GITHUB-REPO>",
    "workflow": "update-task-definition.yml",
    "workflowInputs": {
    "image_uri": "{{.inputs.\"image_uri\"}}",
    "port_context": {
    "entity": "{{ .entity }}",
    "blueprint": "{{ .action.blueprint }}",
    "runId": "{{ .run.id }}",
    "trigger": "{{ .trigger }}"
    }
    },
    "reportWorkflowStatus": true
    }
    },
    "requiredApproval": false
    }
  5. Click Save.

Now you should see the Update Task Definition action in the self-service page. 🎉

Run service health check​

To run an ECS service health check from Port, first add a GitHub workflow that gathers the service diagnostics from AWS. Then create a Port self-service action that triggers the workflow.

Add GitHub workflow

Create the file .github/workflows/service-health-check.yml in the .github/workflows folder of your repository.

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

Service Health Check GitHub workflow (click to expand)
name: ECS Service Health Check

on:
workflow_dispatch:
inputs:
port_context:
required: true
description: 'Action and general context (blueprint, run id, etc...)'
type: string

jobs:
health-check:
runs-on: ubuntu-latest
steps:
- name: Inform Port about workflow start
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: Running health check on ECS service

- 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: ${{ secrets.AWS_REGION }}

- name: Get service details
id: service-details
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "🔍 Checking service health for $SERVICE_ARN in cluster $CLUSTER_NAME"

# Get service details
aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--output table

# Store service status for later use
SERVICE_STATUS=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].status' \
--output text)

RUNNING_COUNT=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].runningCount' \
--output text)

DESIRED_COUNT=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].desiredCount' \
--output text)

echo "service_status=$SERVICE_STATUS" >> $GITHUB_OUTPUT
echo "running_count=$RUNNING_COUNT" >> $GITHUB_OUTPUT
echo "desired_count=$DESIRED_COUNT" >> $GITHUB_OUTPUT

- name: Check running tasks
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "📋 Listing running tasks..."

# List tasks for the service
aws ecs list-tasks \
--cluster "$CLUSTER_NAME" \
--service-name "$SERVICE_ARN" \
--output table

# Get task details if tasks exist
TASK_ARNS=$(aws ecs list-tasks \
--cluster "$CLUSTER_NAME" \
--service-name "$SERVICE_ARN" \
--query 'taskArns' \
--output text)

if [ "$TASK_ARNS" != "None" ] && [ -n "$TASK_ARNS" ]; then
echo "🔍 Task details:"
aws ecs describe-tasks \
--cluster "$CLUSTER_NAME" \
--tasks $TASK_ARNS \
--output table
else
echo "⚠️ No running tasks found"
fi

- name: Check service events
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "📅 Recent service events:"

aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].events[:10]' \
--output table

- name: Health summary
run: |
SERVICE_STATUS="${{ steps.service-details.outputs.service_status }}"
RUNNING_COUNT="${{ steps.service-details.outputs.running_count }}"
DESIRED_COUNT="${{ steps.service-details.outputs.desired_count }}"

echo "📊 Health Summary:"
echo "==================="
echo "Service Status: $SERVICE_STATUS"
echo "Running Tasks: $RUNNING_COUNT"
echo "Desired Tasks: $DESIRED_COUNT"

if [ "$SERVICE_STATUS" = "ACTIVE" ] && [ "$RUNNING_COUNT" = "$DESIRED_COUNT" ]; then
echo "✅ Service is healthy"
HEALTH_STATUS="HEALTHY"
else
echo "⚠️ Service needs attention"
HEALTH_STATUS="UNHEALTHY"
fi

echo "health_status=$HEALTH_STATUS" >> $GITHUB_OUTPUT

- name: Inform Port about health check results
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'SUCCESS'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: |
🏥 Health Check Complete
Status: ${{ steps.service-details.outputs.service_status }}
Running: ${{ steps.service-details.outputs.running_count }}/${{ steps.service-details.outputs.desired_count }} tasks

- name: Inform Port about health check failure
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'FAILURE'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ❌ Health check failed for ECS service ${{ fromJson(inputs.port_context).entity.identifier }}
Create Port action
  1. Go to the Self-service page in Port.

  2. Click on the + New Action button.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration into the editor.

    Service Health Check action (click to expand)
    Replace the variables
    • <GITHUB-ORG> - your GitHub organization or user name.
    • <GITHUB-REPO> - your GitHub repository name.
    • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID.
    {
    "identifier": "service_health_check",
    "title": "Service Health Check",
    "icon": "DefaultProperty",
    "description": "Run diagnostics on service health and check task status",
    "trigger": {
    "type": "self-service",
    "operation": "DAY-2",
    "userInputs": {
    "properties": {},
    "required": [],
    "order": []
    },
    "blueprintIdentifier": "awsEcsService"
    },
    "invocationMethod": {
    "type": "INTEGRATION_ACTION",
    "installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
    "integrationActionType": "dispatch_workflow",
    "integrationActionExecutionProperties": {
    "org": "<GITHUB-ORG>",
    "repo": "<GITHUB-REPO>",
    "workflow": "service-health-check.yml",
    "workflowInputs": {
    "port_context": {
    "entity": "{{ .entity }}",
    "blueprint": "{{ .action.blueprint }}",
    "runId": "{{ .run.id }}",
    "trigger": "{{ .trigger }}"
    }
    },
    "reportWorkflowStatus": true
    }
    },
    "requiredApproval": false
    }
  5. Click Save.

Now you should see the Service Health Check action in the self-service page. 🎉

Roll back deployment​

To roll back an ECS deployment from Port, first add a GitHub workflow that restores the previous task definition. Then create a Port self-service action that triggers the workflow.

Add GitHub workflow

Create the file .github/workflows/rollback-deployment.yml in the .github/workflows folder of your repository.

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

Rollback Deployment GitHub workflow (click to expand)
name: Rollback ECS Deployment

on:
workflow_dispatch:
inputs:
port_context:
required: true
description: 'Action and general context (blueprint, run id, etc...)'
type: string

jobs:
rollback-deployment:
runs-on: ubuntu-latest
steps:
- name: Inform Port about workflow start
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: Initiating rollback for ECS service

- 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: ${{ secrets.AWS_REGION }}

- name: Get current and previous task definitions
id: task-definitions
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

# Get current task definition
CURRENT_TASK_DEF=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].taskDefinition' \
--output text)

echo "current_task_def=$CURRENT_TASK_DEF" >> $GITHUB_OUTPUT
echo "📋 Current task definition: $CURRENT_TASK_DEF"

# Extract family name and current revision
FAMILY_NAME=$(echo $CURRENT_TASK_DEF | sed 's/.*task-definition\/\([^:]*\):.*/\1/')
CURRENT_REVISION=$(echo $CURRENT_TASK_DEF | sed 's/.*://')

echo "family_name=$FAMILY_NAME" >> $GITHUB_OUTPUT
echo "current_revision=$CURRENT_REVISION" >> $GITHUB_OUTPUT

# Calculate previous revision
PREVIOUS_REVISION=$((CURRENT_REVISION - 1))

if [ $PREVIOUS_REVISION -lt 1 ]; then
echo "❌ No previous revision available to rollback to"
exit 1
fi

PREVIOUS_TASK_DEF="$FAMILY_NAME:$PREVIOUS_REVISION"
echo "previous_task_def=$PREVIOUS_TASK_DEF" >> $GITHUB_OUTPUT
echo "🔄 Will rollback to: $PREVIOUS_TASK_DEF"

# Verify previous task definition exists
if ! aws ecs describe-task-definition --task-definition "$PREVIOUS_TASK_DEF" > /dev/null 2>&1; then
echo "❌ Previous task definition $PREVIOUS_TASK_DEF does not exist"
exit 1
fi

- name: Perform rollback
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"
PREVIOUS_TASK_DEF="${{ steps.task-definitions.outputs.previous_task_def }}"

echo "🔄 Rolling back service to previous task definition..."

aws ecs update-service \
--cluster "$CLUSTER_NAME" \
--service "$SERVICE_ARN" \
--task-definition "$PREVIOUS_TASK_DEF"

echo "✅ Rollback initiated"

- name: Wait for rollback to complete
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "⏳ Waiting for rollback deployment to stabilize..."

# Wait for service to become stable
aws ecs wait services-stable \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN"

echo "✅ Rollback completed successfully"

- name: Verify rollback
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"
EXPECTED_TASK_DEF="${{ steps.task-definitions.outputs.previous_task_def }}"

# Verify the service is now using the previous task definition
CURRENT_TASK_DEF=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].taskDefinition' \
--output text)

CURRENT_FAMILY_REV=$(echo $CURRENT_TASK_DEF | sed 's/.*task-definition\/\(.*\)/\1/')

if [[ "$CURRENT_FAMILY_REV" == "$EXPECTED_TASK_DEF" ]]; then
echo "✅ Rollback verification successful"
echo "Service is now running: $CURRENT_TASK_DEF"
else
echo "❌ Rollback verification failed"
echo "Expected: $EXPECTED_TASK_DEF"
echo "Actual: $CURRENT_FAMILY_REV"
exit 1
fi

- name: Inform Port about successful rollback
if: success()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'SUCCESS'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: |
✅ Rollback completed successfully
Rolled back from: ${{ steps.task-definitions.outputs.current_task_def }}
Rolled back to: ${{ steps.task-definitions.outputs.previous_task_def }}

- name: Inform Port about failed rollback
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'FAILURE'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ❌ Failed to rollback ECS service ${{ fromJson(inputs.port_context).entity.identifier }}
Create Port action
  1. Go to the Self-service page in Port.

  2. Click on the + New Action button.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration into the editor.

    Rollback Deployment action (click to expand)
    Replace the variables
    • <GITHUB-ORG> - your GitHub organization or user name.
    • <GITHUB-REPO> - your GitHub repository name.
    • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID.
    {
    "identifier": "rollback_deployment",
    "title": "Rollback Deployment",
    "icon": "AWS",
    "description": "Revert to previous task definition revision",
    "trigger": {
    "type": "self-service",
    "operation": "DAY-2",
    "userInputs": {
    "properties": {},
    "required": [],
    "order": []
    },
    "blueprintIdentifier": "awsEcsService"
    },
    "invocationMethod": {
    "type": "INTEGRATION_ACTION",
    "installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
    "integrationActionType": "dispatch_workflow",
    "integrationActionExecutionProperties": {
    "org": "<GITHUB-ORG>",
    "repo": "<GITHUB-REPO>",
    "workflow": "rollback-deployment.yml",
    "workflowInputs": {
    "port_context": {
    "entity": "{{ .entity }}",
    "blueprint": "{{ .action.blueprint }}",
    "runId": "{{ .run.id }}",
    "trigger": "{{ .trigger }}"
    }
    },
    "reportWorkflowStatus": true
    }
    },
    "requiredApproval": true
    }
  5. Click Save.

Now you should see the Rollback Deployment action in the self-service page. 🎉

Rollback Safety

Note that the rollback action has requiredApproval: true set for safety, as rollbacks can have significant impact on production services.

Delete ECS service​

To delete an ECS service from Port, first add a GitHub workflow that deletes the service in AWS. Then create a Port self-service action that triggers the workflow.

Add GitHub workflow

Create the file .github/workflows/delete-ecs-service.yml in the .github/workflows folder of your repository.

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

Delete ECS Service GitHub workflow (click to expand)
name: Delete ECS Service

on:
workflow_dispatch:
inputs:
confirmation:
description: 'Type DELETE to confirm service deletion'
required: true
type: string
port_context:
required: true
description: 'Action and general context (blueprint, run id, etc...)'
type: string

jobs:
delete-ecs-service:
runs-on: ubuntu-latest
steps:
- name: Validate confirmation
run: |
if [ "${{ github.event.inputs.confirmation }}" != "DELETE" ]; then
echo "❌ Confirmation failed. You must type 'DELETE' exactly to proceed."
exit 1
fi
echo "✅ Confirmation validated"

- name: Inform Port about workflow start
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ⚠️ Initiating ECS service deletion

- 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: ${{ secrets.AWS_REGION }}

- name: Get service information
id: service-info
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "🔍 Getting service information..."

# Get service details before deletion
SERVICE_NAME=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].serviceName' \
--output text)

DESIRED_COUNT=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].desiredCount' \
--output text)

RUNNING_COUNT=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].runningCount' \
--output text)

TASK_DEFINITION=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].taskDefinition' \
--output text)

echo "service_name=$SERVICE_NAME" >> $GITHUB_OUTPUT
echo "desired_count=$DESIRED_COUNT" >> $GITHUB_OUTPUT
echo "running_count=$RUNNING_COUNT" >> $GITHUB_OUTPUT
echo "task_definition=$TASK_DEFINITION" >> $GITHUB_OUTPUT

echo "📋 Service Details:"
echo " Name: $SERVICE_NAME"
echo " Desired Count: $DESIRED_COUNT"
echo " Running Count: $RUNNING_COUNT"
echo " Task Definition: $TASK_DEFINITION"

- name: Scale service to zero
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "⬇️ Scaling service to 0 tasks before deletion..."

aws ecs update-service \
--cluster "$CLUSTER_NAME" \
--service "$SERVICE_ARN" \
--desired-count 0

echo "✅ Service scaled to 0 tasks"

- name: Wait for tasks to stop
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "⏳ Waiting for all tasks to stop..."

# Wait for service to become stable with 0 running tasks
aws ecs wait services-stable \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN"

# Verify no tasks are running
RUNNING_COUNT=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].runningCount' \
--output text)

if [ "$RUNNING_COUNT" -eq 0 ]; then
echo "✅ All tasks have stopped"
else
echo "⚠️ Warning: $RUNNING_COUNT tasks still running"
fi

- name: Delete the service
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "🗑️ Deleting ECS service..."

aws ecs delete-service \
--cluster "$CLUSTER_NAME" \
--service "$SERVICE_ARN" \
--force

echo "✅ Service deletion initiated"

- name: Wait for service deletion
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "⏳ Waiting for service deletion to complete..."

# Wait for service to be deleted (this can take a few minutes)
aws ecs wait services-inactive \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN"

echo "✅ Service successfully deleted"

- name: Verify deletion
run: |
CLUSTER_NAME="${{ fromJson(inputs.port_context).entity.relations.cluster }}"
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "🔍 Verifying service deletion..."

# Check if service still exists
SERVICE_STATUS=$(aws ecs describe-services \
--cluster "$CLUSTER_NAME" \
--services "$SERVICE_ARN" \
--query 'services[0].status' \
--output text 2>/dev/null || echo "NOT_FOUND")

if [ "$SERVICE_STATUS" = "INACTIVE" ] || [ "$SERVICE_STATUS" = "NOT_FOUND" ]; then
echo "✅ Service deletion verified"
else
echo "❌ Service deletion verification failed. Status: $SERVICE_STATUS"
exit 1
fi

- name: Delete Port entity
run: |
SERVICE_ARN="${{ fromJson(inputs.port_context).entity.identifier }}"

echo "🗑️ Deleting corresponding Port entity..."

curl -X DELETE \
-H "Authorization: Bearer $(curl -X POST \
-H "Content-Type: application/json" \
-d '{"clientId": "${{ secrets.PORT_CLIENT_ID }}", "clientSecret": "${{ secrets.PORT_CLIENT_SECRET }}"}' \
https://api.port.io/v1/auth/access_token | jq -r '.accessToken')" \
"https://api.port.io/v1/blueprints/awsEcsService/entities/$(echo '$SERVICE_ARN' | sed 's/[\/:]/%2F/g')"

echo "✅ Port entity deletion requested"

- name: Inform Port about successful deletion
if: success()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'SUCCESS'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: |
✅ ECS Service Successfully Deleted
Service: ${{ steps.service-info.outputs.service_name }}
Previous Desired Count: ${{ steps.service-info.outputs.desired_count }}
Task Definition: ${{ steps.service-info.outputs.task_definition }}

- name: Inform Port about failed deletion
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
status: 'FAILURE'
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: ❌ Failed to delete ECS service ${{ fromJson(inputs.port_context).entity.identifier }}
Create Port action
  1. Go to the Self-service page in Port.

  2. Click on the + New Action button.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration into the editor.

    Delete ECS Service action (click to expand)
    Replace the variables
    • <GITHUB-ORG> - your GitHub organization or user name.
    • <GITHUB-REPO> - your GitHub repository name.
    • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID.
    {
    "identifier": "delete_ecs_service",
    "title": "Delete ECS Service",
    "icon": "AWS",
    "description": "Permanently delete an ECS service",
    "trigger": {
    "type": "self-service",
    "operation": "DELETE",
    "userInputs": {
    "properties": {
    "confirmation": {
    "title": "Confirmation",
    "type": "string",
    "description": "Type 'DELETE' to confirm permanent deletion",
    "pattern": "^DELETE$"
    }
    },
    "required": ["confirmation"],
    "order": ["confirmation"]
    },
    "blueprintIdentifier": "awsEcsService"
    },
    "invocationMethod": {
    "type": "INTEGRATION_ACTION",
    "installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
    "integrationActionType": "dispatch_workflow",
    "integrationActionExecutionProperties": {
    "org": "<GITHUB-ORG>",
    "repo": "<GITHUB-REPO>",
    "workflow": "delete-ecs-service.yml",
    "workflowInputs": {
    "confirmation": "{{.inputs.\"confirmation\"}}",
    "port_context": {
    "entity": "{{ .entity }}",
    "blueprint": "{{ .action.blueprint }}",
    "runId": "{{ .run.id }}",
    "trigger": "{{ .trigger }}"
    }
    },
    "reportWorkflowStatus": true
    }
    },
    "requiredApproval": true
    }
  5. Click Save.

Now you should see the Delete ECS Service action in the self-service page. 🎉

Destructive Operation

The delete service action includes multiple safety measures:

  • Double confirmation: Requires typing "DELETE" exactly
  • Manual approval: requiredApproval: true
  • Graceful shutdown: Scales to 0 before deletion
  • Verification: Confirms deletion completed
  • Port cleanup: Removes the entity from Port catalog

Let's test it!​

Now that you have set up all the self-service actions, let's test them to ensure they work correctly with your ECS services.

  1. Head to the self-service page in Port.

  2. Click on the Service Health Check action.

    • Choose any ECS service from your catalog.
    • Click on Execute.
    • Verify the health summary provides useful insights about your service.
  3. Scale ECS Service

    • Click on the Scale ECS Service action.
    • Choose an ECS service that currently has running tasks.
    • Enter a different desired count (e.g., if it has 2 tasks, try 3 or 1).
    • Click on Execute.
    • Wait for the scaling operation to complete.
    • Verify in the AWS Console that the service now has the new desired count.
  4. Update Task Definition

    • Click on the Update Task Definition action.
    • Choose an ECS service to update.
    • Enter a new container image URI. Some examples:
      • If currently using nginx:1.24, try nginx:1.25
      • If using a custom image, try a different tag like :v2.0
    • Click on Execute.
  5. Restart ECS Service

    • Click on the Restart ECS Service action.
    • Choose an ECS service to restart.
    • Click on Execute.
  6. Rollback Deployment

    • Click on the Rollback Deployment action.
    • Choose an ECS service that has been updated at least once.
    • Click on Execute.
    • Approve the action when prompted (due to requiredApproval: true).
    • Monitor the rollback process:
      • Previous task definition identified
      • Service updated to previous revision
      • Deployment completion verification
  7. Delete ECS Service

    • Click on the Delete ECS Service action.
    • Choose a test service that can be safely deleted.
    • Type DELETE exactly in the confirmation field.
    • Click on Execute.
    • Approve the action when prompted.
    • Monitor the deletion process:
      • Service information captured
      • Scaling to 0 tasks
      • Service deletion
      • Verification of removal

Visualize metrics​

With your data and actions in place, we can create a dedicated dashboard in Port to visualize all ECS services by state, launch type, or cluster using customizable widgets. In addition, we can trigger actions (scale, restart) directly from the dashboard.

Create a dashboard​

  1. Navigate to the Catalog page in Port.

  2. Click on the + button in the left sidebar.

  3. Select New dashboard.

  4. Name the dashboard ECS Management.

  5. Input Scale and restart your AWS ECS services under Description.

  6. Select the AWS icon.

  7. Click Create.

We now have a blank dashboard where we can start adding widgets to visualize insights from our AWS ECS.

Add widgets​

In the new dashboard, create the following widgets:

Total ECS services (click to expand)
  1. Click + Widget and select Number Chart.

  2. Title: Total services (add the AWS icon).

  3. Select Count entities Chart type and choose AWS ECS Service as the Blueprint.

  4. Select count for the Function.

  5. Select custom as the Unit and input services as the Custom unit

  6. Click Save.

Services by launch type (click to expand)
  1. Click + Widget and select Pie chart.

  2. Title: Services by launch type (add the AWS icon).

  3. Choose the AWS ECS Service blueprint.

  4. Under Breakdown by property, select the Launch Type property

  5. Click Save.

Service health status (click to expand)
  1. Click + Widget and select Pie chart.

  2. Title: Service health status (add the DefaultProperty icon).

  3. Choose the AWS ECS Service blueprint.

  4. Under Breakdown by property, select the Health Status property

  5. Click Save.

ECS services view (click to expand)
  1. Click + Widget and select Table.

  2. Title the widget All Services.

  3. Choose the AWS ECS Service blueprint

  4. Click Save to add the widget to the dashboard.

  5. Click on the ... button in the top right corner of the table and select Customize table.

  6. In the top right corner of the table, click on Manage Properties and add the following properties:

    • Status: The current status of the service.
    • Desired Count: Target number of tasks.
    • Launch Type: How tasks are launched.
    • Cluster: Related ECS cluster.
  7. Click on the save icon in the top right corner of the widget to save the customized table.

Task count distribution (click to expand)
  1. Click + Widget and select Number Chart.

  2. Title: Total running tasks (add the DefaultProperty icon).

  3. Choose the AWS ECS Service blueprint.

  4. Select count as the Aggregation function.

  5. Under Measure property, select the Running Count property.

  6. Select custom as the Unit and input tasks as the Custom unit.

  7. Click Save.

Platform version overview (click to expand)
  1. Click + Widget and select Pie chart.

  2. Title: Platform versions (add the DefaultProperty icon).

  3. Choose the AWS ECS Service blueprint.

  4. Under Breakdown by property, select the Platform Version property.

  5. Click Save.

ECS management actions (click to expand)
  1. Click + Widget and select Action Card.

  2. Title: ECS service management (add the AWS icon).

  3. Choose the AWS ECS Service blueprint.

  4. Under Actions, select all the ECS management actions we created:

    • Scale ECS Service
    • Restart ECS Service
    • Update Task Definition
    • Service Health Check
    • Rollback Deployment
    • Delete ECS Service
  5. Click Save.

AWS EC2 instances​

Use this section to bring your AWS EC2 management experience into Port using workflows.

In this section, you will:

  • Ingest EC2 data into Port's context lake using Port's AWS integration.
  • Set up workflows to manage EC2 instances (start, reboot, and terminate).
  • Build dashboards in Port to monitor and take action on your EC2 resources.

Prerequisites

This section assumes the following:

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

EC2 Management dashboard with instance charts EC2 Instances table with day-2 workflows

Set up data model​

When installing the AWS integration in Port, the AWS Account blueprint is created by default. However, the EC2 Instance blueprint is not created automatically, so we will create it manually.

Create the EC2 instance blueprint​

  1. Go to the Data model page in Port.

  2. Click on + Blueprint.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration:

AWS EC2 Instance blueprint (click to expand)
{
"identifier": "ec2Instance",
"description": "This blueprint represents an AWS EC2 instance in our context lake",
"title": "EC2 Instance",
"icon": "EC2",
"schema": {
"properties": {
"monitoring": {
"type": "boolean",
"title": "Monitoring",
"description": "Indicates if detailed monitoring is enabled for the EC2 instance."
},
"instance_state": {
"type": "string",
"title": "Instance State",
"description": "The state of the EC2 instance (e.g., running, stopped).",
"enum": [
"pending",
"running",
"shutting-down",
"terminated",
"stopping",
"stopped"
],
"enumColors": {
"pending": "yellow",
"running": "green",
"shutting-down": "pink",
"stopped": "purple",
"stopping": "orange",
"terminated": "red"
}
},
"instance_type": {
"type": "string",
"title": "Instance Type",
"description": "The type of EC2 instance (e.g., t2.micro, m5.large)."
},
"availability_zone": {
"type": "string",
"title": "Availability Zone",
"description": "The Availability Zone where the EC2 instance is deployed."
},
"public_dns": {
"type": "string",
"title": "Public DNS",
"description": "The public DNS name assigned to the EC2 instance."
},
"private_dns": {
"type": "string",
"title": "Private DNS",
"description": "The private DNS name assigned to the EC2 instance within its VPC."
},
"security_group_ids": {
"type": "array",
"title": "Security Group IDs",
"description": "The list of security group IDs assigned to the EC2 instance."
},
"key_name": {
"type": "string",
"title": "Key Name",
"description": "The name of the key pair associated with the EC2 instance."
},
"image": {
"type": "string",
"title": "Image ID",
"description": "The image ID of the EC2 instance."
},
"tags": {
"type": "array",
"title": "Tags",
"description": "The tags assigned to the EC2 instance."
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"account": {
"title": "Account",
"target": "awsAccount",
"required": false,
"many": false
}
}
}
  1. Click Save to create the blueprint.

Update the integration mapping​

  1. Go to the Connectors page in Port.
  2. Select the AWS integration.
  3. Add the following YAML block into the editor to ingest EC2 instances from your AWS account:
AWS integration configuration (click to expand)
deleteDependentEntities: true
createMissingRelatedEntities: true
enableMergeEntity: true
resources:
- kind: AWS::Organizations::Account
selector:
query: 'true'
port:
entity:
mappings:
identifier: .Id
title: .Name
blueprint: '"awsAccount"'
properties:
arn: .Arn
email: .Email
status: .Status
joined_method: .JoinedMethod
joined_timestamp: .JoinedTimestamp | sub(" "; "T")
- kind: AWS::EC2::Instance
selector:
query: 'true'
useGetResourceAPI: true
port:
entity:
mappings:
identifier: .Identifier
title: (.Properties.Tags[]? | select(.Key == "Name") | .Value | tostring) // .Identifier
blueprint: '"ec2Instance"'
properties:
instance_state: .Properties.State.Name
image: .Properties.ImageId
availability_zone: .Properties.AvailabilityZone
tags: .Properties.Tags
instance_type: .Properties.InstanceType
public_dns: .Properties.PublicDnsName
private_dns: .Properties.PrivateDnsName
security_group_ids: .Properties.SecurityGroupIds
monitoring: .Properties.Monitoring
key_name: .Properties.KeyName
relations:
account: .__AccountId
  1. Click Save & Resync to apply the mapping.

Set up workflows​

We will create workflows in Port that dispatch GitHub Actions through your installed GitHub Ocean integration. These workflows let users:

  1. Start an EC2 instance.
  2. Reboot an EC2 instance.
  3. Terminate an EC2 instance.

Each EC2 workflow uses an entity-context self-service trigger so it appears both on the Self-service page and in the bolt (⚡) menu on ec2Instance entities. A dataset filter on the entity input shows each workflow only for instances in a matching state: Start for stopped instances, Reboot for running instances, and Terminate for instances that are not already terminated.

To resize the Auto Scaling Group an instance belongs to, see Resize an Auto Scaling Group.

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 - AWS region (for example, us-east-1).
Required permissions

The AWS IAM user must have the ec2:StartInstances, ec2:RebootInstances, and ec2:TerminateInstances permissions.

Keep these repository secrets configured before creating the Port workflows.

Secrets and integration actions

Secrets are not supported in INTEGRATION_ACTION nodes. GitHub authentication uses your installed GitHub Ocean integration. Keep AWS credentials in GitHub repository secrets, not in the Port workflow JSON.

Start an EC2 instance​

To start an EC2 instance from Port, first add a GitHub Actions workflow that starts the instance in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/start-instance.yaml in the .github/workflows folder of your repository.

Start EC2 GitHub workflow (click to expand)
name: Start EC2 Instance

on:
workflow_dispatch:
inputs:
instance_id:
description: 'EC2 instance ID (Port entity identifier)'
required: true
type: string

jobs:
start-instance:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Start EC2 instance
env:
INSTANCE_ID: ${{ inputs.instance_id }}
run: aws ec2 start-instances --instance-ids "$INSTANCE_ID"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Start EC2 instance workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "start_ec2_instance",
"title": "Start EC2 Instance",
"icon": "EC2",
"description": "Start a stopped AWS EC2 instance. Use when a user asks to start, power on, or bring up an EC2 instance. Requires the EC2 instance entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Start EC2 instance",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "ec2_instance"
}
],
"userInputs": {
"properties": {
"ec2_instance": {
"title": "EC2 Instance",
"description": "The stopped EC2 instance to start",
"type": "string",
"format": "entity",
"blueprint": "ec2Instance",
"icon": "EC2",
"dataset": {
"combinator": "and",
"rules": [
{
"property": "instance_state",
"operator": "=",
"value": "stopped"
}
]
}
}
},
"required": [
"ec2_instance"
],
"order": [
"ec2_instance"
]
}
}
},
{
"identifier": "dispatch_start",
"title": "Start EC2 instance",
"icon": "Github",
"links": [
"https://console.aws.amazon.com/ec2/home#InstanceDetails:instanceId={{ .outputs.trigger.ec2_instance }}"
],
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "start-instance.yaml",
"workflowInputs": {
"instance_id": "{{ .outputs.trigger.ec2_instance }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_start"
}
]
}

You can run Start EC2 Instance from Self-service or from the bolt menu on an ec2Instance entity.

Reboot an EC2 instance​

To reboot an EC2 instance from Port, first add a GitHub Actions workflow that reboots the instance in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/reboot-instance.yaml in the .github/workflows folder of your repository.

Reboot EC2 GitHub workflow (click to expand)
name: Reboot EC2 Instance

on:
workflow_dispatch:
inputs:
instance_id:
description: 'EC2 instance ID (Port entity identifier)'
required: true
type: string

jobs:
reboot-instance:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Reboot EC2 instance
env:
INSTANCE_ID: ${{ inputs.instance_id }}
run: aws ec2 reboot-instances --instance-ids "$INSTANCE_ID"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Reboot EC2 instance workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "reboot_ec2_instance",
"title": "Reboot EC2 Instance",
"icon": "EC2",
"description": "Reboot a running AWS EC2 instance. Use when a user asks to reboot or restart an EC2 instance. Requires the EC2 instance entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Reboot EC2 instance",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "ec2_instance"
}
],
"userInputs": {
"properties": {
"ec2_instance": {
"title": "EC2 Instance",
"description": "The running EC2 instance to reboot",
"type": "string",
"format": "entity",
"blueprint": "ec2Instance",
"icon": "EC2",
"dataset": {
"combinator": "and",
"rules": [
{
"property": "instance_state",
"operator": "=",
"value": "running"
}
]
}
}
},
"required": [
"ec2_instance"
],
"order": [
"ec2_instance"
]
}
}
},
{
"identifier": "dispatch_reboot",
"title": "Reboot EC2 instance",
"icon": "Github",
"links": [
"https://console.aws.amazon.com/ec2/home#InstanceDetails:instanceId={{ .outputs.trigger.ec2_instance }}"
],
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "reboot-instance.yaml",
"workflowInputs": {
"instance_id": "{{ .outputs.trigger.ec2_instance }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_reboot"
}
]
}

You can run Reboot EC2 Instance from Self-service or from the bolt menu on an ec2Instance entity.

Terminate an EC2 instance​

To terminate an EC2 instance from Port, first add a GitHub Actions workflow that terminates the instance in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/terminate-instance.yaml in the .github/workflows folder of your repository.

Terminate EC2 GitHub workflow (click to expand)
name: Terminate EC2 Instance

on:
workflow_dispatch:
inputs:
instance_id:
description: 'EC2 instance ID (Port entity identifier)'
required: true
type: string

jobs:
terminate-instance:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Terminate EC2 instance
env:
INSTANCE_ID: ${{ inputs.instance_id }}
run: aws ec2 terminate-instances --instance-ids "$INSTANCE_ID"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Terminate EC2 instance workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "terminate_ec2_instance",
"title": "Terminate EC2 Instance",
"icon": "EC2",
"description": "Permanently terminate an AWS EC2 instance after admin approval. Use only when a user explicitly asks to terminate or destroy an EC2 instance. Requires the EC2 instance entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Terminate EC2 instance",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "ec2_instance"
}
],
"userInputs": {
"properties": {
"ec2_instance": {
"title": "EC2 Instance",
"description": "The EC2 instance to terminate. This cannot be undone.",
"type": "string",
"format": "entity",
"blueprint": "ec2Instance",
"icon": "EC2",
"dataset": {
"combinator": "and",
"rules": [
{
"property": "instance_state",
"operator": "!=",
"value": "terminated"
}
]
}
}
},
"required": [
"ec2_instance"
],
"order": [
"ec2_instance"
]
},
"variant": "ALERT"
}
},
{
"identifier": "approval",
"title": "Approve request",
"config": {
"type": "INPUT",
"description": "Approve terminating EC2 instance {{ .outputs.trigger.ec2_instance }}, requested by {{ .workflowRun.trigger.by.email }}. Termination cannot be undone.",
"userInputs": {
"properties": {
"reason": {
"type": "string",
"title": "Reason",
"description": "Why you are approving or declining this request."
}
},
"buttons": [
{
"identifier": "approve",
"label": "Approve",
"variant": "PRIMARY"
},
{
"identifier": "decline",
"label": "Decline",
"variant": "DANGER"
}
]
},
"outlets": [
{
"evaluationMethod": "button",
"identifier": "approve",
"title": "Approve",
"numOfResponders": 1
},
{
"evaluationMethod": "button",
"identifier": "decline",
"title": "Decline",
"numOfResponders": 1,
"workflowStatusLabel": {
"text": "Declined",
"variant": "alert"
}
}
],
"responders": {
"roles": [
"Admin"
]
}
}
},
{
"identifier": "dispatch_terminate",
"title": "Terminate EC2 instance",
"icon": "Github",
"links": [
"https://console.aws.amazon.com/ec2/home#InstanceDetails:instanceId={{ .outputs.trigger.ec2_instance }}"
],
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "terminate-instance.yaml",
"workflowInputs": {
"instance_id": "{{ .outputs.trigger.ec2_instance }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "approval"
},
{
"sourceIdentifier": "approval",
"targetIdentifier": "dispatch_terminate",
"sourceOutletIdentifier": "approve"
}
]
}

You can run Terminate EC2 Instance from Self-service or from the bolt menu on an ec2Instance entity.

Approval before termination

Terminating an instance cannot be undone, so this workflow uses the ALERT trigger variant to style it as a destructive operation, and an input node that waits for a user with the Admin role to approve the request before the GitHub workflow is dispatched. If the request is declined, the run ends with a Declined status label. Adjust responders to the users, teams, or roles that should approve terminations.

Visualize metrics​

With your data and workflows in place, we can create a dedicated dashboard in Port to visualize all EC2 instances by state, type, or account using customizable widgets.

Create a dashboard​

  1. Navigate to your software catalog.
  2. Click on the + button in the left sidebar.
  3. Select New dashboard.
  4. Name the dashboard EC2 Management.
  5. Input Start, stop or reboot your AWS EC2 instances under Description.
  6. Select the EC2 icon.
  7. Click Create.

We now have a blank dashboard where we can start adding widgets to visualize insights from our AWS EC2.

Add widgets​

In the new dashboard, create the following widgets:

Instance by state (click to expand)
  1. Click + Widget and select Pie chart.
  2. Title: Instance by state (add the EC2 icon).
  3. Choose the EC2 Instance blueprint.
  4. Under Breakdown by property, select the Instance State property. Pie chart configured for EC2 Instance State
  5. Click Save.
Instance by type (click to expand)
  1. Click + Widget and select Pie chart.
  2. Title: Instance by type (add the EC2 icon).
  3. Choose the EC2 Instance blueprint.
  4. Under Breakdown by property, select the Instance Type property. Pie chart configured for EC2 Instance Type
  5. Click Save.
Total instances (click to expand)
  1. Click + Widget and select Number Chart.
  2. Title: Total instances (add the EC2 icon).
  3. Select Count entities Chart type and choose EC2 Instance as the Blueprint.
  4. Select count for the Function.
  5. Select custom as the Unit and input instances as the Custom unit. Number chart counting total EC2 instances
  6. Click Save.
EC2 instances view (click to expand)
  1. Click + Widget and select Table.
  2. Title the widget All Instances.
  3. Choose the EC2 Instance blueprint. Table widget configured for all EC2 instances
  4. Click Save to add the widget to the dashboard.
  5. Click on the ... button in the top right corner of the table and select Customize table.
  6. In the top right corner of the table, click on Manage Properties and add the following properties:
    • Instance State: The current state of the instance.
    • Instance Type: The instance type.
    • Account: The name of each related AWS account.
  7. Click on the save icon in the top right corner of the widget to save the customized table.

AWS S3 buckets and RDS instances​

Use this section to set up a monitoring solution to gain visibility into security configurations from your AWS S3 and RDS instances using Port's AWS integration and workflows.

In this section, you will:

  • Ingest AWS S3 and RDS data into Port's context lake using Port's AWS integration.
  • Set up workflows to manage RDS instances (reboot and delete).
  • Build dashboards in Port to monitor and take action on your AWS storage resources.

Prerequisites

This section assumes the following:

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

AWS Data Security Overview dashboard RDS Instances table with day-2 workflows

Set up data model​

When installing the AWS integration in Port, the AWS Account blueprint is created by default. However, the S3 and RDS Instance blueprints are not created automatically, so we will create them manually.

Create the S3 blueprint​

  1. Go to the Data model page in Port.

  2. Click on + Blueprint.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration:

AWS S3 blueprint (click to expand)
{
"identifier": "awsS3Bucket",
"description": "This blueprint represents an AWS S3 bucket in our context lake",
"title": "S3",
"icon": "Bucket",
"schema": {
"properties": {
"link": {
"type": "string",
"format": "url",
"title": "Link"
},
"regionalDomainName": {
"type": "string",
"title": "Regional Domain Name"
},
"versioningStatus": {
"type": "string",
"title": "Versioning Status",
"enum": [
"Enabled",
"Suspended"
]
},
"encryption": {
"type": "array",
"title": "Encryption"
},
"lifecycleRules": {
"type": "array",
"title": "Lifecycle Rules"
},
"publicAccessConfig": {
"type": "object",
"title": "Public Access"
},
"tags": {
"type": "array",
"title": "Tags"
},
"arn": {
"type": "string",
"title": "ARN"
},
"region": {
"type": "string",
"title": "Region"
},
"blockPublicAccess": {
"type": "boolean",
"title": "Block Public Access"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"account": {
"title": "account",
"target": "awsAccount",
"required": false,
"many": false
}
}
}
  1. Click Save to create the blueprint.

Create the RDS instance blueprint​

  1. Go to the Data model page in Port.

  2. Click on + Blueprint.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration:

AWS RDS instance blueprint (click to expand)
{
"identifier": "rdsInstance",
"description": "This blueprint represents an AWS RDS DBInstance in our context lake",
"title": "RDS Instance",
"icon": "AWS",
"schema": {
"properties": {
"link": {
"type": "string",
"format": "url",
"title": "Link"
},
"dbInstanceClass": {
"type": "string",
"title": "DB Instance Class"
},
"dbInstanceStatus": {
"type": "string",
"title": "DB Instance Status"
},
"engine": {
"type": "string",
"title": "Engine"
},
"storageType": {
"type": "string",
"title": "Storage Type"
},
"engineVersion": {
"type": "string",
"title": "Engine Version"
},
"port": {
"type": "number",
"title": "Port"
},
"allocatedStorage": {
"type": "number",
"title": "Allocated Storage"
},
"endpoint": {
"type": "string",
"title": "Endpoint"
},
"multiAZ": {
"type": "boolean",
"title": "Multi-AZ"
},
"deletionProtection": {
"type": "boolean",
"title": "Deletion Protection"
},
"availabilityZone": {
"type": "string",
"title": "Availability Zone"
},
"masterUsername": {
"type": "string",
"title": "Master Username"
},
"publicAccess": {
"type": "boolean",
"title": "Public Access"
},
"vpcSecurityGroups": {
"type": "array",
"items": {
"type": "string"
},
"title": "VPC Security Groups"
},
"arn": {
"type": "string",
"title": "ARN"
},
"storageEncrypted": {
"type": "boolean",
"title": "Storage Encrypted"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"account": {
"title": "Account",
"target": "awsAccount",
"required": true,
"many": false
}
}
}
  1. Click Save to create the blueprint.

Update integration mapping​

  1. Go to the Connectors page in Port.
  2. Select the AWS integration.
  3. Add the following YAML block into the editor to ingest storage data from AWS:
AWS integration configuration (click to expand)
deleteDependentEntities: true
createMissingRelatedEntities: true
enableMergeEntity: true
resources:
- kind: AWS::Organizations::Account
selector:
query: 'true'
port:
entity:
mappings:
identifier: .Id
title: .Name
blueprint: '"awsAccount"'
properties:
arn: .Arn
email: .Email
status: .Status
joined_method: .JoinedMethod
joined_timestamp: .JoinedTimestamp | sub(" "; "T")
- kind: AWS::S3::Bucket
selector:
query: 'true'
useGetResourceAPI: true
port:
entity:
mappings:
identifier: .Identifier
title: .Identifier
blueprint: '"awsS3Bucket"'
properties:
regionalDomainName: .Properties.RegionalDomainName
encryption: .Properties.BucketEncryption.ServerSideEncryptionConfiguration
lifecycleRules: .Properties.LifecycleConfiguration.Rules
publicAccessConfig: .Properties.PublicAccessBlockConfiguration
blockPublicAccess: >-
.Properties.PublicAccessBlockConfiguration | (.BlockPublicAcls and
.IgnorePublicAcls and .BlockPublicPolicy and
.RestrictPublicBuckets)
tags: .Properties.Tags
arn: .Properties.Arn
region: .Properties.RegionalDomainName | capture(".*\\.(?<region>[^\\.]+)\\.amazonaws\\.com") | .region
link: .Properties | select(.Arn != null) | "https://console.aws.amazon.com/go/view?arn=" + .Arn
relations:
account: .__AccountId
- kind: AWS::RDS::DBInstance
selector:
query: 'true'
useGetResourceAPI: true
port:
entity:
mappings:
identifier: .Identifier
title: .Properties.DBInstanceIdentifier
blueprint: '"rdsInstance"'
properties:
link: '"https://console.aws.amazon.com/go/view?arn=" + .Properties.DBInstanceArn'
dbInstanceClass: .Properties.DBInstanceClass
dbInstanceStatus: .Properties.DBInstanceStatus
engine: .Properties.Engine
storageType: .Properties.StorageType
engineVersion: .Properties.EngineVersion
port: .Properties.Endpoint.Port
allocatedStorage: .Properties.AllocatedStorage
endpoint: .Properties.Endpoint.Address
multiAZ: .Properties.MultiAZ
deletionProtection: .Properties.DeletionProtection
availabilityZone: .Properties.AvailabilityZone
masterUsername: .Properties.MasterUsername
publicAccess: .Properties.PubliclyAccessible
vpcSecurityGroups: .Properties.VpcSecurityGroups
arn: .Properties.DBInstanceArn
storageEncrypted: .Properties.StorageEncrypted
relations:
account: .__AccountId
  1. Click Save & Resync to apply the mapping.

Set up workflows​

We will create workflows in Port that dispatch GitHub Actions through your installed GitHub Ocean integration. These workflows let users:

  1. Reboot an RDS instance.
  2. Delete an RDS instance.

Each workflow uses an entity-context self-service trigger so it appears both on the Self-service page and in the bolt (⚡) menu on rdsInstance entities. A dataset filter on the entity input shows Reboot only for available instances and Delete only for instances without deletion protection.

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 - AWS region (for example, us-east-1).
Required permissions

The AWS IAM user must have the rds:RebootDBInstance and rds:DeleteDBInstance permissions. When you delete an instance with a final snapshot, the user also needs permission to create that snapshot.

Keep these repository secrets configured before creating the Port workflows.

Secrets and integration actions

Secrets are not supported in INTEGRATION_ACTION nodes. GitHub authentication uses your installed GitHub Ocean integration. Keep AWS credentials in GitHub repository secrets, not in the Port workflow JSON.

Reboot an RDS instance​

To reboot an RDS instance from Port, first add a GitHub Actions workflow that reboots the instance in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/reboot-rds-instance.yaml in the .github/workflows folder of your repository.

Reboot RDS GitHub workflow (click to expand)
name: Reboot RDS Instance

on:
workflow_dispatch:
inputs:
db_instance_id:
description: 'RDS DB instance identifier (Port entity identifier)'
required: true
type: string

jobs:
reboot-rds-instance:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Reboot RDS instance
env:
DB_INSTANCE_ID: ${{ inputs.db_instance_id }}
run: aws rds reboot-db-instance --db-instance-identifier "$DB_INSTANCE_ID"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Reboot RDS instance workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "reboot_rds_instance",
"title": "Reboot RDS Instance",
"icon": "AmazonRDS",
"description": "Reboot an available AWS RDS DB instance. Use when a user asks to reboot or restart an RDS database instance. Requires the RDS instance entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Reboot RDS instance",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "rds_instance"
}
],
"userInputs": {
"properties": {
"rds_instance": {
"title": "RDS Instance",
"description": "The RDS instance to reboot",
"type": "string",
"format": "entity",
"blueprint": "rdsInstance",
"icon": "AmazonRDS",
"dataset": {
"combinator": "and",
"rules": [
{
"property": "dbInstanceStatus",
"operator": "=",
"value": "available"
}
]
}
}
},
"required": [
"rds_instance"
],
"order": [
"rds_instance"
]
}
}
},
{
"identifier": "dispatch_reboot",
"title": "Reboot RDS instance",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "reboot-rds-instance.yaml",
"workflowInputs": {
"db_instance_id": "{{ .outputs.trigger.rds_instance }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_reboot"
}
]
}

You can run Reboot RDS Instance from Self-service or from the bolt menu on an rdsInstance entity.

Delete an RDS instance​

To delete an RDS instance from Port, first add a GitHub Actions workflow that deletes the instance in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/delete-rds-instance.yaml in the .github/workflows folder of your repository.

Delete RDS GitHub workflow (click to expand)
name: Delete RDS Instance

on:
workflow_dispatch:
inputs:
db_instance_id:
description: 'RDS DB instance identifier (Port entity identifier)'
required: true
type: string
skip_final_snapshot:
description: "'true' to skip the final DB snapshot, 'false' to create one before deletion"
required: true
default: 'false'
type: string

jobs:
delete-rds-instance:
runs-on: ubuntu-latest
steps:
- 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: ${{ secrets.AWS_REGION }}

- name: Delete RDS instance
env:
DB_INSTANCE_ID: ${{ inputs.db_instance_id }}
SKIP_FINAL_SNAPSHOT: ${{ inputs.skip_final_snapshot }}
run: |
if [ "$SKIP_FINAL_SNAPSHOT" = "true" ]; then
aws rds delete-db-instance \
--db-instance-identifier "$DB_INSTANCE_ID" \
--skip-final-snapshot
else
# --no-skip-final-snapshot requires a final snapshot identifier
aws rds delete-db-instance \
--db-instance-identifier "$DB_INSTANCE_ID" \
--no-skip-final-snapshot \
--final-db-snapshot-identifier "${DB_INSTANCE_ID}-final-$(date +%Y%m%d%H%M%S)"
fi
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Delete RDS instance workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "delete_rds_instance",
"title": "Delete RDS Instance",
"icon": "AmazonRDS",
"description": "Permanently delete an AWS RDS DB instance after admin approval, optionally taking a final snapshot. Use only when a user explicitly asks to delete an RDS instance. Requires the RDS instance entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Delete RDS instance",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "rds_instance"
}
],
"userInputs": {
"properties": {
"rds_instance": {
"title": "RDS Instance",
"description": "The RDS instance to delete. Instances with deletion protection enabled cannot be deleted.",
"type": "string",
"format": "entity",
"blueprint": "rdsInstance",
"icon": "AmazonRDS",
"dataset": {
"combinator": "and",
"rules": [
{
"property": "deletionProtection",
"operator": "!=",
"value": true
}
]
}
},
"skip_final_snapshot": {
"type": "boolean",
"title": "Skip final snapshot",
"description": "When off (recommended), a final DB snapshot is created before deletion",
"default": false
}
},
"required": [
"rds_instance"
],
"order": [
"rds_instance",
"skip_final_snapshot"
]
},
"variant": "ALERT"
}
},
{
"identifier": "approval",
"title": "Approve request",
"config": {
"type": "INPUT",
"description": "Approve deleting RDS instance {{ .outputs.trigger.rds_instance }} (skip final snapshot: {{ .outputs.trigger.skip_final_snapshot | tostring }}), requested by {{ .workflowRun.trigger.by.email }}.",
"userInputs": {
"properties": {
"reason": {
"type": "string",
"title": "Reason",
"description": "Why you are approving or declining this request."
}
},
"buttons": [
{
"identifier": "approve",
"label": "Approve",
"variant": "PRIMARY"
},
{
"identifier": "decline",
"label": "Decline",
"variant": "DANGER"
}
]
},
"outlets": [
{
"evaluationMethod": "button",
"identifier": "approve",
"title": "Approve",
"numOfResponders": 1
},
{
"evaluationMethod": "button",
"identifier": "decline",
"title": "Decline",
"numOfResponders": 1,
"workflowStatusLabel": {
"text": "Declined",
"variant": "alert"
}
}
],
"responders": {
"roles": [
"Admin"
]
}
}
},
{
"identifier": "dispatch_delete",
"title": "Delete RDS instance",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "delete-rds-instance.yaml",
"workflowInputs": {
"db_instance_id": "{{ .outputs.trigger.rds_instance }}",
"skip_final_snapshot": "{{ .outputs.trigger.skip_final_snapshot // false | tostring }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "approval"
},
{
"sourceIdentifier": "approval",
"targetIdentifier": "dispatch_delete",
"sourceOutletIdentifier": "approve"
}
]
}

You can run Delete RDS Instance from Self-service or from the bolt menu on an rdsInstance entity.

Approval before deletion

Like the terminate EC2 workflow, this workflow uses the ALERT trigger variant and an input node that waits for a user with the Admin role to approve the request. Unless Skip final snapshot is selected, the GitHub workflow creates a final DB snapshot named <instance>-final-<timestamp> before the instance is deleted.

Visualize metrics​

With your data and workflows in place, we can create a dedicated dashboard in Port to monitor and analyze security configurations and access controls using customizable widgets.

Create a dashboard​

  1. Navigate to your context lake.

  2. Click on the + button in the left sidebar.

  3. Select New dashboard.

  4. Name the dashboard AWS Storage Security Overview.

  5. Input Monitor and manage AWS S3 buckets and RDS instances security configurations under Description.

  6. Select the AWS icon.

  7. Click Create.

We now have a blank dashboard where we can start adding widgets to visualize security insights from our AWS storage.

Add widgets​

In the new dashboard, create the following widgets:

RDS by availability zone (click to expand)
  1. Click + Widget and select Pie chart.

  2. Title: RDS by availability zone (add the AmazonRDS icon).

  3. Choose the RDS Instance blueprint.

  4. Under Breakdown by property, select the Availability Zone property

    RDS pie chart broken down by availability zone
  5. Click Save.

RDS by public access (click to expand)
  1. Click + Widget and select Pie chart.

  2. Title: RDS by public access (add the AmazonRDS icon).

  3. Choose the RDS Instance blueprint.

  4. Under Breakdown by property, select the Public Access property

    RDS pie chart broken down by public access
  5. Click Save.

Unprotected RDS by engine (click to expand)
  1. Click + Widget and select Pie chart.

  2. Title: Unprotected RDS by engine (add the AmazonRDS icon).

  3. Choose the RDS Instance blueprint.

  4. Under Breakdown by property, select the Engine property.

  5. Add this JSON to the Initial filters editor to filter unprotected RDS instances:

    [
    {
    "combinator":"and",
    "rules":[
    {
    "property":"deletionProtection",
    "operator":"=",
    "value":false
    }
    ]
    }
    ]
    Unprotected RDS instances pie chart by engine
  6. Click Save.

RDS without SSL (click to expand)
  1. Click + Widget and select Number Chart.

  2. Title: RDS without SSL (add the AmazonRDS icon).

  3. Select Count entities Chart type and choose RDS Instance as the Blueprint.

  4. Select count for the Function.

  5. Add this JSON to the Initial filters editor to filter RDS instances without SSL configuration:

    [
    {
    "combinator":"and",
    "rules":[
    {
    "property":"storageEncrypted",
    "operator":"=",
    "value":false
    }
    ]
    }
    ]
    Number chart counting RDS instances without SSL
  6. Click Save.

S3 buckets by public access (click to expand)
  1. Click + Widget and select Pie chart.

  2. Title: S3 by public access (add the S3 icon).

  3. Choose the S3 blueprint.

  4. Under Breakdown by property, select the Block Public Access property

    S3 buckets pie chart by public access setting
  5. Click Save.

Unencrypted S3 buckets (click to expand)
  1. Click + Widget and select Number Chart.

  2. Title: Unencrypted S3 buckets (add the S3 icon).

  3. Select Count entities Chart type and choose S3 as the Blueprint.

  4. Select count for the Function.

  5. Add this JSON to the Initial filters editor to filter S3 buckets without encryption configurations:

    [
    {
    "combinator":"and",
    "rules":[
    {
    "property":"encryption",
    "operator":"isNotEmpty"
    }
    ]
    }
    ]
    Number chart counting unencrypted S3 buckets
  6. Click Save.

Insecure RDS instances table (click to expand)
  1. Click + Widget and select Table.

  2. Title the widget Insecure RDS Instances.

  3. Choose the RDS Instance blueprint

  4. Add this JSON to the Initial filters editor to filter insecure RDS instances:

    [
    {
    "combinator":"or",
    "rules":[
    {
    "property":"storageEncrypted",
    "operator":"=",
    "value":false
    },
    {
    "property":"deletionProtection",
    "operator":"=",
    "value":false
    },
    {
    "property":"publicAccess",
    "operator":"=",
    "value":true
    }
    ]
    }
    ]
  5. Click Save to add the widget to the dashboard.

  6. Click on the ... button in the top right corner of the table and select Customize table.

  7. In the top right corner of the table, click on Manage Properties and add the following properties:

    • DB Instance Status: The current status of the RDS instance.
    • Engine: The database engine type.
    • Storage Encrypted: Whether storage encryption is enabled.
    • Deletion Protection: Whether deletion protection is enabled.
    • Public Access: Whether the instance is publicly accessible.
    • Account: The name of each related AWS account.
  8. Click on the save icon in the top right corner of the widget to save the customized table.

GCP Compute Engine instances​

Use this section to bring your GCP Compute Engine management experience into Port.

In this section, you will:

  • Ingest Compute Engine data into Port's context lake using Port's GCP integration.
  • Set up self-service actions to manage Compute Engine instances (start and stop).
  • Build dashboards in Port to monitor and take action on your Compute Engine resources.

Prerequisites

This section assumes the following:

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

GCP Compute Engine dashboard with instance status GCP Compute Engine instances table with operations

Set up data model​

When installing the GCP integration in Port, the GCP Project blueprint is created by default. However, the Compute Instance blueprint is not created automatically so we will need to create it manually.

Create the Compute Instance blueprint​

  1. Go to the Data model page in Port.

  2. Click on + Blueprint.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration:

    GCP Compute Instance blueprint (click to expand)
    {
    "identifier": "gcpComputeInstance",
    "description": "This blueprint represents a GCP Compute Instance in our context lake",
    "title": "Compute Instance",
    "icon": "GoogleCloud",
    "schema": {
    "properties": {
    "subnetworks": {
    "title": "Subnetwork",
    "type": "array"
    },
    "cpuPlatform": {
    "title": "CPU Platform",
    "type": "string"
    },
    "status": {
    "type": "string",
    "title": "Status",
    "enum": [
    "RUNNING",
    "STOPPING",
    "TERMINATED"
    ],
    "enumColors": {
    "RUNNING": "green",
    "STOPPING": "lightGray",
    "TERMINATED": "red"
    }
    },
    "createdAt": {
    "type": "string",
    "title": "Created At",
    "format": "date-time"
    },
    "tags": {
    "type": "object",
    "title": "Tags"
    },
    "deletionProtection": {
    "type": "boolean",
    "title": "Deletion Protection"
    },
    "lastStartedAt": {
    "type": "string",
    "title": "Last Started At",
    "format": "date-time"
    },
    "selfLink": {
    "type": "string",
    "title": "Self Link",
    "format": "url"
    },
    "zone": {
    "type": "string",
    "title": "Zone"
    }
    },
    "required": []
    },
    "mirrorProperties": {},
    "calculationProperties": {},
    "aggregationProperties": {},
    "relations": {
    "project": {
    "title": "Project",
    "target": "gcpProject",
    "required": false,
    "many": false
    }
    }
    }
  5. Click Save to create the blueprint.

Update the integration mapping​

  1. Go to the Connectors page in Port.

  2. Select the GCP integration.

  3. Add the following YAML block into the editor to ingest compute instances from your GCP projects:

    GCP integration configuration (click to expand)
    deleteDependentEntities: true
    createMissingRelatedEntities: true
    enableMergeEntity: true
    resources:
    - kind: cloudresourcemanager.googleapis.com/Project
    selector:
    query: 'true'
    port:
    entity:
    mappings:
    identifier: .name
    title: .display_name
    blueprint: '"gcpProject"'
    properties:
    labels: .labels
    - kind: compute.googleapis.com/Instance
    selector:
    query: 'true'
    port:
    entity:
    mappings:
    identifier: .id
    title: .name
    blueprint: '"gcpComputeInstance"'
    properties:
    machineType: .machineType
    createdAt: .creationTimestamp
    status: .status
    subnetworks: .networkInterfaces[].subnetwork
    cpuPlatform: .cpuPlatform
    selfLink: .selfLink
    tags: .tags
    deletionProtection: .deletionProtection
    lastStartedAt: .lastStartTimestamp
    zone: .zone | split("/")[-1]
    relations:
    project: .__project.name
  4. Click Save & Resync to apply the mapping.

Set up self-service actions​

Now let us create self-service actions to manage your Compute Engine instances directly from Port using GitHub Actions. You will implement workflows to:

  1. Start a Compute Engine instance.

  2. Stop a Compute Engine instance.

To implement these use-cases, follow the steps below:

Add GitHub secrets

In your GitHub repository, go to Settings > Secrets and add the following secrets:

  • PORT_CLIENT_ID - Port Client ID learn more.
  • PORT_CLIENT_SECRET - Port Client Secret learn more.
  • GCP_SERVICE_ACCOUNT_KEY - Your GCP service account key JSON (minified to a single line).
Minifying JSON for GitHub Secrets

To avoid aggressive log sanitization, minify your service account JSON into a single line before storing it as a GitHub secret. You can use an online tool or the following command to minify the json:

jq -c '.' your-service-account-key.json | pbcopy

Before running the workflows, make sure the service account has the required Compute Engine permissions.

Required permissions

The GCP service account must have the following permissions:

  • compute.instances.start - to start Compute Engine instances
  • compute.instances.stop - to stop Compute Engine instances
  • compute.instances.get - to read instance details (used to extract zone information)
  • compute.zones.get - to list zones (for zone validation)

Alternatively, you can assign the roles/compute.instanceAdmin.v1 role which includes these permissions.

Start a Compute Engine instance​

To start a Compute Engine instance from Port, first add a GitHub workflow that starts the instance in GCP. Then create a Port self-service action that triggers the workflow.

Add GitHub workflow

Create the file .github/workflows/start-gcp-instance.yaml in the .github/workflows folder of your repository.

Start Compute Engine GitHub workflow (click to expand)
name: Start GCP Compute Engine Instance

on:
workflow_dispatch:
inputs:
port_context:
required: true
description: 'Action and general context (blueprint, entity, run id, etc...)'
type: string

jobs:
start-instance:
runs-on: ubuntu-latest
# Add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: 'actions/checkout@v6'

- name: Inform Port of workflow start
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: Configuring GCP credentials to start Compute Engine instance with name ${{ fromJson(inputs.port_context).entity.title }}

- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}'

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2

- name: Start Compute Engine instance
run: |
gcloud compute instances start ${{ fromJson(inputs.port_context).entity.title }} --zone=${{ fromJson(inputs.port_context).entity.properties.zone }}

- name: Inform Port about Compute Engine start success
if: success()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{ fromJson(inputs.port_context).runId }}
status: 'SUCCESS'
logMessage: ✅ Compute Engine instance with name ${{ fromJson(inputs.port_context).entity.title }} started successfully
summary: Compute Engine instance start completed successfully

- name: Inform Port about Compute Engine start failure
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{ fromJson(inputs.port_context).runId }}
status: 'FAILURE'
logMessage: ❌ Failed to start Compute Engine instance with name ${{ fromJson(inputs.port_context).entity.title }}
summary: Compute Engine instance start failed
Create Port action
  1. Go to the Self-service page in Port.

  2. Click on the + New Action button.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration into the editor.

    Start Compute Engine instance action (click to expand)
    Replace the variables
    • <GITHUB-ORG> - your GitHub organization or user name.
    • <GITHUB-REPO> - your GitHub repository name.
    • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID.
    {
    "identifier": "start_gcp_compute_instance",
    "title": "Start Compute Engine Instance",
    "icon": "GoogleCloud",
    "description": "Start a GCP Compute Engine Instance",
    "trigger": {
    "type": "self-service",
    "operation": "DAY-2",
    "userInputs": {
    "properties": {},
    "required": []
    },
    "blueprintIdentifier": "gcpComputeInstance"
    },
    "invocationMethod": {
    "type": "INTEGRATION_ACTION",
    "installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
    "integrationActionType": "dispatch_workflow",
    "integrationActionExecutionProperties": {
    "org": "<GITHUB-ORG>",
    "repo": "<GITHUB-REPO>",
    "workflow": "start-gcp-instance.yaml",
    "workflowInputs": {
    "port_context": {
    "entity": "{{ .entity }}",
    "runId": "{{ .run.id }}"
    }
    },
    "reportWorkflowStatus": true
    }
    },
    "requiredApproval": false
    }
  5. Click Save.

Now you should see the Start Compute Engine Instance action in the self-service page. 🎉

Stop a Compute Engine instance​

To stop a Compute Engine instance from Port, first add a GitHub workflow that stops the instance in GCP. Then create a Port self-service action that triggers the workflow.

Add GitHub workflow

Create the file .github/workflows/stop-gcp-instance.yaml in the .github/workflows folder of your repository.

Stop Compute Engine GitHub workflow (click to expand)
name: Stop GCP Compute Engine Instance

on:
workflow_dispatch:
inputs:
port_context:
required: true
description: 'Action and general context (blueprint, entity, run id, etc...)'
type: string

jobs:
stop-instance:
runs-on: ubuntu-latest
# Add "id-token" with the intended permissions.
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: 'actions/checkout@v6'

- name: Inform Port of workflow stop
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{fromJson(inputs.port_context).runId}}
logMessage: Configuring GCP credentials to stop Compute Engine instance with name ${{ fromJson(inputs.port_context).entity.title }}

- id: 'auth'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}'

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2

- name: Stop Compute Engine instance
run: |
gcloud compute instances stop ${{ fromJson(inputs.port_context).entity.title }} --zone=${{ fromJson(inputs.port_context).entity.properties.zone }}

- name: Inform Port about Compute Engine stop success
if: success()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{ fromJson(inputs.port_context).runId }}
status: 'SUCCESS'
logMessage: ✅ Compute Engine instance with name ${{ fromJson(inputs.port_context).entity.title }} stopped successfully
summary: Compute Engine instance stop completed successfully

- name: Inform Port about Compute Engine stop failure
if: failure()
uses: port-labs/port-github-action@v1
with:
clientId: ${{ secrets.PORT_CLIENT_ID }}
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }}
baseUrl: https://api.port.io
operation: PATCH_RUN
runId: ${{ fromJson(inputs.port_context).runId }}
status: 'FAILURE'
logMessage: ❌ Failed to stop Compute Engine instance with name ${{ fromJson(inputs.port_context).entity.title }}
summary: Compute Engine instance stop failed
Create Port action
  1. Go to the Self-service page in Port.

  2. Click on the + New Action button.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration into the editor.

    Stop Compute Engine instance action (click to expand)
    Replace the variables
    • <GITHUB-ORG> - your GitHub organization or user name.
    • <GITHUB-REPO> - your GitHub repository name.
    • <YOUR_GITHUB_OCEAN_INTEGRATION_ID> - your GitHub Ocean integration installation ID.
    {
    "identifier": "stop_gcp_compute_instance",
    "title": "Stop Compute Engine Instance",
    "icon": "GoogleCloud",
    "description": "Stop a GCP Compute Engine Instance",
    "trigger": {
    "type": "self-service",
    "operation": "DAY-2",
    "userInputs": {
    "properties": {},
    "required": []
    },
    "blueprintIdentifier": "gcpComputeInstance"
    },
    "invocationMethod": {
    "type": "INTEGRATION_ACTION",
    "installationId": "<YOUR_GITHUB_OCEAN_INTEGRATION_ID>",
    "integrationActionType": "dispatch_workflow",
    "integrationActionExecutionProperties": {
    "org": "<GITHUB-ORG>",
    "repo": "<GITHUB-REPO>",
    "workflow": "stop-gcp-instance.yaml",
    "workflowInputs": {
    "port_context": {
    "entity": "{{ .entity }}",
    "blueprint": "{{ .action.blueprint }}",
    "runId": "{{ .run.id }}"
    }
    },
    "reportWorkflowStatus": true
    }
    },
    "requiredApproval": false
    }
  5. Click Save.

Now you should see the Stop Compute Engine Instance action in the self-service page. 🎉

Visualize metrics​

With your data and actions in place, we can create a dedicated dashboard in Port to visualize all Compute Engine instances by status, track deletion protection, and take action directly from the dashboard.

Create a dashboard​

  1. Navigate to your context lake.

  2. Click on the + button in the left sidebar.

  3. Select New dashboard.

  4. Name the dashboard GCP Compute Engine Management.

  5. Input Start, stop or monitor your GCP Compute Engine instances under Description.

  6. Select the GoogleCloud icon.

  7. Click Create.

We now have a blank dashboard where we can start adding widgets to visualize insights from our GCP Compute Engine instances.

Add widgets​

In the new dashboard, create the following widgets:

Total instances (click to expand)
  1. Click + Widget and select Number Chart.

  2. Title: Total instances (add the GoogleCloud icon).

  3. Select Count entities Chart type and choose Compute Instance as the Blueprint.

  4. Select count for the Function.

  5. Select custom as the Unit and input instances as the Custom unit

  6. Click Save.

Instances without deletion protection (click to expand)
  1. Click + Widget and select Number Chart.

  2. Title: Instances without deletion protection (add the GoogleCloud icon).

  3. Select Count entities Chart type and choose Compute Instance as the Blueprint.

  4. Add a filter: deletionProtection equals false.

  5. Select count for the Function.

  6. Select custom as the Unit and input instances as the Custom unit

  7. Click Save.

Instance by status (click to expand)
  1. Click + Widget and select Pie chart.

  2. Title: Instance by status (add the GoogleCloud icon).

  3. Choose the Compute Instance blueprint.

  4. Under Breakdown by property, select the Status property

  5. Click Save.

Compute instances view (click to expand)
  1. Click + Widget and select Table.

  2. Title the widget All Instances.

  3. Choose the Compute Instance blueprint

  4. Click Save to add the widget to the dashboard.

  5. Click on the ... button in the top right corner of the table and select Customize table.

  6. In the top right corner of the table, click on Manage Properties and add the following properties:

    • Status: The current status of the instance.
    • Created At: When the instance was created.
    • Deletion Protection: Whether deletion protection is enabled.
    • Project: The name of each related GCP project.
    • Zone: The zone where the instance is located.
  7. Click on the save icon in the top right corner of the widget to save the customized table.

Azure Virtual Machines​

Use this section to bring your Azure Virtual Machine management experience into Port using workflows.

In this section, you will:

  • Ingest Azure Virtual Machine data into Port's context lake using Port's Azure integration.
  • Set up workflows to manage Azure Virtual Machines (start, deallocate, and restart).

Prerequisites

This section assumes the following:

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

Azure VM Manager dashboard with day-2 operations

Set up data model​

When installing the Azure integration in Port, the Azure Subscription and Azure Resource Group blueprints are created by default. However, the Virtual Machine blueprint is not created automatically, so we will create it manually.

Create the Virtual Machine blueprint​

  1. Go to the Data model page in Port.

  2. Click on + Blueprint.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration:

    Azure Virtual Machine blueprint (click to expand)
    {
    "identifier": "azureVirtualMachine",
    "description": "This blueprint represents an Azure Virtual Machine in our context lake",
    "title": "Virtual Machine",
    "icon": "Azure",
    "schema": {
    "properties": {
    "location": {
    "title": "Location",
    "type": "string"
    },
    "provisioningState": {
    "title": "Provisioning State",
    "type": "string"
    },
    "vmSize": {
    "title": "VM Size",
    "type": "string"
    },
    "osDiskName": {
    "title": "OS Disk Name",
    "type": "string"
    },
    "osType": {
    "title": "OS Type",
    "type": "string"
    },
    "osDiskCaching": {
    "title": "OS Disk Caching",
    "type": "string"
    },
    "osDiskSizeGB": {
    "title": "OS Disk Size GB",
    "type": "number"
    },
    "osDiskCreateOption": {
    "title": "OS Disk Create Option",
    "type": "string"
    },
    "networkInterfaceIds": {
    "title": "Network Interface IDs",
    "type": "array"
    },
    "licenseType": {
    "title": "License Type",
    "type": "string"
    },
    "vmOsProfile": {
    "title": "VM OS Profile",
    "type": "object"
    },
    "vmHardwareProfile": {
    "title": "VM Hardware Profile",
    "type": "object"
    },
    "vmStorageProfile": {
    "title": "VM Storage Profile",
    "type": "object"
    },
    "tags": {
    "title": "Tags",
    "type": "object"
    }
    },
    "required": []
    },
    "mirrorProperties": {},
    "calculationProperties": {},
    "aggregationProperties": {},
    "relations": {
    "resourceGroup": {
    "title": "Resource Group",
    "target": "azureResourceGroup",
    "required": false,
    "many": false
    }
    }
    }
  5. Click Save to create the blueprint.

Update the integration mapping​

  1. Go to the Connectors page in Port.

  2. Select the Azure integration.

  3. Add the following YAML block into the editor to ingest Azure Virtual Machines from your Azure subscription:

    Azure integration configuration (click to expand)
    deleteDependentEntities: true
    createMissingRelatedEntities: true
    enableMergeEntity: true
    resources:
    - kind: subscription
    selector:
    query: 'true'
    apiVersion: '2022-09-01'
    port:
    entity:
    mappings:
    identifier: .id
    title: .display_name
    blueprint: '"azureSubscription"'
    properties:
    tags: .tags
    - kind: Microsoft.Resources/resourceGroups
    selector:
    query: 'true'
    apiVersion: '2022-09-01'
    port:
    entity:
    mappings:
    identifier: >-
    .id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase |
    join("/")
    title: .name
    blueprint: '"azureResourceGroup"'
    properties:
    location: .location
    provisioningState: .properties.provisioningState + .properties.provisioning_state
    tags: .tags
    relations:
    subscription: >-
    .id | split("/") | .[1] |= ascii_downcase |.[2] |= ascii_downcase
    | .[:3] |join("/")
    - kind: Microsoft.Compute/virtualMachines
    selector:
    query: 'true'
    apiVersion: '2023-03-01'
    port:
    entity:
    mappings:
    identifier: >-
    .id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase |
    join("/")
    title: .name
    blueprint: '"azureVirtualMachine"'
    properties:
    location: .location
    provisioningState: .properties.provisioningState
    vmSize: .properties.hardwareProfile.vmSize
    osDiskName: .properties.storageProfile.osDisk.name
    osType: .properties.storageProfile.osDisk.osType
    osDiskCaching: .properties.storageProfile.osDisk.caching
    osDiskSizeGB: .properties.storageProfile.osDisk.diskSizeGB
    osDiskCreateOption: .properties.storageProfile.osDisk.createOption
    networkInterfaceIds: .properties.networkProfile.networkInterfaces[].id
    licenseType: .properties.licenseType
    vmOsProfile: .properties.osProfile
    vmHardwareProfile: .properties.hardwareProfile
    vmStorageProfile: .properties.storageProfile
    tags: .tags
    relations:
    resourceGroup: >-
    .id | split("/") | .[3] |= ascii_downcase | .[4] |= ascii_downcase
    | .[:5] |join("/")
  4. Click Save & Resync to apply the mapping.

Set up workflows​

We will create workflows in Port that dispatch GitHub Actions through your installed GitHub Ocean integration. These workflows let users:

  1. Start an Azure Virtual Machine.
  2. Deallocate an Azure Virtual Machine.
  3. Restart an Azure Virtual Machine.

Each workflow uses an entity-context self-service trigger so it appears both on the Self-service page and in the bolt (⚡) menu on azureVirtualMachine entities.

Add GitHub secrets

In your GitHub repository, go to Settings > Secrets and add the following secrets:

  • AZURE_CLIENT_ID - Azure service principal client ID.
  • AZURE_CLIENT_SECRET - Azure service principal client secret.
  • AZURE_TENANT_ID - Azure tenant ID.
Required permissions

The Azure service principal must have the following permissions to manage Virtual Machines:

  • Microsoft.Compute/virtualMachines/start/action.
  • Microsoft.Compute/virtualMachines/deallocate/action.
  • Microsoft.Compute/virtualMachines/restart/action.
  • Microsoft.Compute/virtualMachines/read.

Alternatively, you can assign the Virtual Machine Contributor built-in role which includes these permissions.

Keep these repository secrets configured before creating the Port workflows.

Secrets and integration actions

Secrets are not supported in INTEGRATION_ACTION nodes. GitHub authentication uses your installed GitHub Ocean integration. Keep Azure credentials in GitHub repository secrets, not in the Port workflow JSON.

Start an Azure Virtual Machine​

To start an Azure Virtual Machine from Port, first add a GitHub Actions workflow that starts the virtual machine in Azure. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/start-azure-vm.yaml in the .github/workflows folder of your repository.

Start Azure Virtual Machine GitHub workflow (click to expand)
name: Start Azure Virtual Machine

on:
workflow_dispatch:
inputs:
resource_name:
description: 'Virtual Machine name'
required: true
type: string
resource_group:
description: 'Azure resource group name'
required: true
type: string
subscription_id:
description: 'Azure subscription ID'
required: true
type: string

jobs:
start-vm:
runs-on: ubuntu-latest
steps:
- name: Azure Login
uses: azure/login@v2
env:
AZURE_LOGIN_PRE_CLEANUP: true
AZURE_LOGIN_POST_CLEANUP: true
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ inputs.subscription_id }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'

- name: Start Azure Virtual Machine
env:
RESOURCE_NAME: ${{ inputs.resource_name }}
RESOURCE_GROUP: ${{ inputs.resource_group }}
run: az vm start --name "$RESOURCE_NAME" --resource-group "$RESOURCE_GROUP"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Start Azure Virtual Machine workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "start_azure_vm",
"title": "Start Azure Virtual Machine",
"icon": "Azure",
"description": "Start an Azure Virtual Machine. Use when a user asks to start, power on, or bring up an Azure VM. Requires the Azure Virtual Machine entity.",
"category": "Azure cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Start Azure virtual machine",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "azure_virtual_machine"
}
],
"userInputs": {
"properties": {
"azure_virtual_machine": {
"title": "Virtual Machine",
"description": "The Azure Virtual Machine to start",
"type": "string",
"format": "entity",
"blueprint": "azureVirtualMachine",
"icon": "Azure"
}
},
"required": [
"azure_virtual_machine"
],
"order": [
"azure_virtual_machine"
]
}
}
},
{
"identifier": "dispatch_start",
"title": "Start Azure virtual machine",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "start-azure-vm.yaml",
"workflowInputs": {
"resource_name": "{{ .outputs.trigger.azure_virtual_machine | split(\"/\") | last }}",
"resource_group": "{{ .outputs.trigger.azure_virtual_machine | split(\"/\") | .[4] }}",
"subscription_id": "{{ .outputs.trigger.azure_virtual_machine | split(\"/\") | .[2] }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_start"
}
]
}

You can run Start Azure Virtual Machine from Self-service or from the bolt menu on an azureVirtualMachine entity.

Deallocate an Azure Virtual Machine​

To deallocate an Azure Virtual Machine from Port, first add a GitHub Actions workflow that deallocates the virtual machine in Azure. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/deallocate-azure-vm.yaml in the .github/workflows folder of your repository.

Deallocate Azure Virtual Machine GitHub workflow (click to expand)
name: Deallocate Azure Virtual Machine

on:
workflow_dispatch:
inputs:
resource_name:
description: 'Virtual Machine name'
required: true
type: string
resource_group:
description: 'Azure resource group name'
required: true
type: string
subscription_id:
description: 'Azure subscription ID'
required: true
type: string

jobs:
deallocate-vm:
runs-on: ubuntu-latest
steps:
- name: Azure Login
uses: azure/login@v2
env:
AZURE_LOGIN_PRE_CLEANUP: true
AZURE_LOGIN_POST_CLEANUP: true
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ inputs.subscription_id }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'

- name: Deallocate Azure Virtual Machine
env:
RESOURCE_NAME: ${{ inputs.resource_name }}
RESOURCE_GROUP: ${{ inputs.resource_group }}
run: az vm deallocate --name "$RESOURCE_NAME" --resource-group "$RESOURCE_GROUP"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Deallocate Azure Virtual Machine workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "deallocate_azure_vm",
"title": "Deallocate Azure Virtual Machine",
"icon": "Azure",
"description": "Stop and deallocate an Azure Virtual Machine to release its compute resources. Use when a user asks to stop, shut down, or deallocate an Azure VM. Requires the Azure Virtual Machine entity.",
"category": "Azure cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Deallocate Azure virtual machine",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "azure_virtual_machine"
}
],
"userInputs": {
"properties": {
"azure_virtual_machine": {
"title": "Virtual Machine",
"description": "The Azure Virtual Machine to stop and deallocate",
"type": "string",
"format": "entity",
"blueprint": "azureVirtualMachine",
"icon": "Azure"
}
},
"required": [
"azure_virtual_machine"
],
"order": [
"azure_virtual_machine"
]
}
}
},
{
"identifier": "dispatch_deallocate",
"title": "Deallocate Azure virtual machine",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "deallocate-azure-vm.yaml",
"workflowInputs": {
"resource_name": "{{ .outputs.trigger.azure_virtual_machine | split(\"/\") | last }}",
"resource_group": "{{ .outputs.trigger.azure_virtual_machine | split(\"/\") | .[4] }}",
"subscription_id": "{{ .outputs.trigger.azure_virtual_machine | split(\"/\") | .[2] }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_deallocate"
}
]
}

You can run Deallocate Azure Virtual Machine from Self-service or from the bolt menu on an azureVirtualMachine entity.

Restart an Azure Virtual Machine​

To restart an Azure Virtual Machine from Port, first add a GitHub Actions workflow that restarts the virtual machine in Azure. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/restart-azure-vm.yaml in the .github/workflows folder of your repository.

Restart Azure Virtual Machine GitHub workflow (click to expand)
name: Restart Azure Virtual Machine

on:
workflow_dispatch:
inputs:
resource_name:
description: 'Virtual Machine name'
required: true
type: string
resource_group:
description: 'Azure resource group name'
required: true
type: string
subscription_id:
description: 'Azure subscription ID'
required: true
type: string

jobs:
restart-vm:
runs-on: ubuntu-latest
steps:
- name: Azure Login
uses: azure/login@v2
env:
AZURE_LOGIN_PRE_CLEANUP: true
AZURE_LOGIN_POST_CLEANUP: true
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ inputs.subscription_id }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'

- name: Restart Azure Virtual Machine
env:
RESOURCE_NAME: ${{ inputs.resource_name }}
RESOURCE_GROUP: ${{ inputs.resource_group }}
run: az vm restart --name "$RESOURCE_NAME" --resource-group "$RESOURCE_GROUP"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Restart Azure Virtual Machine workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "restart_azure_vm",
"title": "Restart Azure Virtual Machine",
"icon": "Azure",
"description": "Restart a running Azure Virtual Machine. Use when a user asks to restart or reboot an Azure VM. Requires the Azure Virtual Machine entity.",
"category": "Azure cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Restart Azure virtual machine",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "azure_virtual_machine"
}
],
"userInputs": {
"properties": {
"azure_virtual_machine": {
"title": "Virtual Machine",
"description": "The Azure Virtual Machine to restart",
"type": "string",
"format": "entity",
"blueprint": "azureVirtualMachine",
"icon": "Azure"
}
},
"required": [
"azure_virtual_machine"
],
"order": [
"azure_virtual_machine"
]
}
}
},
{
"identifier": "dispatch_restart",
"title": "Restart Azure virtual machine",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "restart-azure-vm.yaml",
"workflowInputs": {
"resource_name": "{{ .outputs.trigger.azure_virtual_machine | split(\"/\") | last }}",
"resource_group": "{{ .outputs.trigger.azure_virtual_machine | split(\"/\") | .[4] }}",
"subscription_id": "{{ .outputs.trigger.azure_virtual_machine | split(\"/\") | .[2] }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_restart"
}
]
}

You can run Restart Azure Virtual Machine from Self-service or from the bolt menu on an azureVirtualMachine entity.

Azure web apps​

Use this section to bring your Azure web app management experience into Port using workflows.

In this section, you will:

  • Ingest Azure web app data into Port's context lake using Port's Azure integration.
  • Set up workflows to manage Azure web apps (start, stop, and restart).
  • Build dashboards in Port to monitor and take action on your Azure web app resources.

Prerequisites

This section assumes the following:

Dedicated Workflows Repository

We recommend creating a dedicated repository for the workflows that are used by Port actions.

Azure Web App Manager dashboard with charts Azure web apps table with day-2 operations

Set up data model​

When installing the Azure integration in Port, the Azure Subscription and Azure Resource Group blueprints are created by default. However, the Web App blueprint is not created automatically, so we will create it manually.

Create the Web App blueprint​

  1. Go to the Data model page in Port.

  2. Click on + Blueprint.

  3. Click on the {...} Edit JSON button.

  4. Copy and paste the following JSON configuration:

    Azure Web App blueprint (click to expand)
    {
    "identifier": "azureWebApp",
    "description": "This blueprint represents an Azure Web App in our context lake",
    "title": "Web App",
    "icon": "Azure",
    "schema": {
    "properties": {
    "location": {
    "title": "Location",
    "type": "string"
    },
    "enabled": {
    "title": "Enabled",
    "type": "boolean"
    },
    "defaultHostName": {
    "title": "Default Host Name",
    "type": "string"
    },
    "appServicePlanId": {
    "title": "App Service Plan ID",
    "type": "string"
    },
    "state": {
    "icon": "DefaultProperty",
    "title": "State",
    "type": "string",
    "enum": [
    "Running",
    "Stopped",
    "Starting",
    "Stopping",
    "Failed",
    "Restarting",
    "Pending",
    "Unknown",
    "Provisioning"
    ],
    "enumColors": {
    "Running": "green",
    "Stopped": "red",
    "Starting": "lime",
    "Stopping": "bronze",
    "Failed": "red",
    "Restarting": "yellow",
    "Pending": "lightGray",
    "Unknown": "lightGray",
    "Provisioning": "blue"
    }
    }
    },
    "required": []
    },
    "mirrorProperties": {},
    "calculationProperties": {},
    "aggregationProperties": {},
    "relations": {
    "resourceGroup": {
    "title": "Resource Group",
    "target": "azureResourceGroup",
    "required": false,
    "many": false
    }
    }
    }
  5. Click Save to create the blueprint.

Update the integration mapping​

  1. Go to the Connectors page in Port.

  2. Select the Azure integration.

  3. Add the following YAML block into the editor to ingest Azure web apps from your Azure subscription:

    Azure integration configuration (click to expand)
    deleteDependentEntities: true
    createMissingRelatedEntities: true
    enableMergeEntity: true
    resources:
    - kind: subscription
    selector:
    query: 'true'
    apiVersion: '2022-09-01'
    port:
    entity:
    mappings:
    identifier: .id
    title: .display_name
    blueprint: '"azureSubscription"'
    properties:
    tags: .tags
    - kind: Microsoft.Resources/resourceGroups
    selector:
    query: 'true'
    apiVersion: '2022-09-01'
    port:
    entity:
    mappings:
    identifier: >-
    .id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase |
    join("/")
    title: .name
    blueprint: '"azureResourceGroup"'
    properties:
    location: .location
    provisioningState: .properties.provisioningState + .properties.provisioning_state
    tags: .tags
    relations:
    subscription: >-
    .id | split("/") | .[1] |= ascii_downcase |.[2] |= ascii_downcase
    | .[:3] |join("/")
    - kind: Microsoft.Web/sites
    selector:
    query: 'true'
    apiVersion: '2022-03-01'
    port:
    entity:
    mappings:
    identifier: >-
    .id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase |
    join("/")
    title: .name
    blueprint: '"azureWebApp"'
    properties:
    location: .location
    state: .properties.state
    enabled: .properties.enabled
    defaultHostName: .properties.defaultHostName
    appServicePlanId: .properties.serverFarmId
    relations:
    resourceGroup: >-
    .id | split("/") | .[3] |= ascii_downcase |.[4] |= ascii_downcase
    | .[:5] |join("/")
  4. Click Save & Resync to apply the mapping.

Set up workflows​

We will create workflows in Port that dispatch GitHub Actions through your installed GitHub Ocean integration. These workflows let users:

  1. Start an Azure web app.
  2. Stop an Azure web app.
  3. Restart an Azure web app.

Each workflow uses an entity-context self-service trigger so it appears both on the Self-service page and in the bolt (⚡) menu on azureWebApp entities.

Add GitHub secrets

In your GitHub repository, go to Settings > Secrets and add the following secrets:

  • AZURE_CLIENT_ID - Azure service principal client ID.
  • AZURE_CLIENT_SECRET - Azure service principal client secret.
  • AZURE_TENANT_ID - Azure tenant ID.
Required permissions

The Azure service principal must have the following permissions to manage web apps:

  • Microsoft.Web/sites/start/action.
  • Microsoft.Web/sites/stop/action.
  • Microsoft.Web/sites/restart/action.
  • Microsoft.Web/sites/read.

Alternatively, you can assign the Website Contributor built-in role which includes these permissions.

Keep these repository secrets configured before creating the Port workflows.

Secrets and integration actions

Secrets are not supported in INTEGRATION_ACTION nodes. GitHub authentication uses your installed GitHub Ocean integration. Keep Azure credentials in GitHub repository secrets, not in the Port workflow JSON.

Start an Azure web app​

To start an Azure web app from Port, first add a GitHub Actions workflow that starts the web app in Azure. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/start-azure-webapp.yaml in the .github/workflows folder of your repository.

Start Azure Web App GitHub workflow (click to expand)
name: Start Azure Web App

on:
workflow_dispatch:
inputs:
resource_name:
description: 'Web App name'
required: true
type: string
resource_group:
description: 'Azure resource group name'
required: true
type: string
subscription_id:
description: 'Azure subscription ID'
required: true
type: string

jobs:
start-webapp:
runs-on: ubuntu-latest
steps:
- name: Azure Login
uses: azure/login@v2
env:
AZURE_LOGIN_PRE_CLEANUP: true
AZURE_LOGIN_POST_CLEANUP: true
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ inputs.subscription_id }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'

- name: Start Azure Web App
env:
RESOURCE_NAME: ${{ inputs.resource_name }}
RESOURCE_GROUP: ${{ inputs.resource_group }}
run: az webapp start --name "$RESOURCE_NAME" --resource-group "$RESOURCE_GROUP"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Start Azure Web App workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "start_azure_webapp",
"title": "Start Azure Web App",
"icon": "Azure",
"description": "Start a stopped Azure web app. Use when a user asks to start or bring up an Azure App Service web app. Requires the Azure web app entity.",
"category": "Azure cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Start Azure web app",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "azure_web_app"
}
],
"userInputs": {
"properties": {
"azure_web_app": {
"title": "Web App",
"description": "The stopped Azure web app to start",
"type": "string",
"format": "entity",
"blueprint": "azureWebApp",
"icon": "Azure"
}
},
"required": [
"azure_web_app"
],
"order": [
"azure_web_app"
]
}
}
},
{
"identifier": "dispatch_start",
"title": "Start Azure web app",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "start-azure-webapp.yaml",
"workflowInputs": {
"resource_name": "{{ .outputs.trigger.azure_web_app | split(\"/\") | last }}",
"resource_group": "{{ .outputs.trigger.azure_web_app | split(\"/\") | .[4] }}",
"subscription_id": "{{ .outputs.trigger.azure_web_app | split(\"/\") | .[2] }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_start"
}
]
}

You can run Start Azure Web App from Self-service or from the bolt menu on an azureWebApp entity.

Stop an Azure web app​

To stop an Azure web app from Port, first add a GitHub Actions workflow that stops the web app in Azure. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/stop-azure-webapp.yaml in the .github/workflows folder of your repository.

Stop Azure Web App GitHub workflow (click to expand)
name: Stop Azure Web App

on:
workflow_dispatch:
inputs:
resource_name:
description: 'Web App name'
required: true
type: string
resource_group:
description: 'Azure resource group name'
required: true
type: string
subscription_id:
description: 'Azure subscription ID'
required: true
type: string

jobs:
stop-webapp:
runs-on: ubuntu-latest
steps:
- name: Azure Login
uses: azure/login@v2
env:
AZURE_LOGIN_PRE_CLEANUP: true
AZURE_LOGIN_POST_CLEANUP: true
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ inputs.subscription_id }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'

- name: Stop Azure Web App
env:
RESOURCE_NAME: ${{ inputs.resource_name }}
RESOURCE_GROUP: ${{ inputs.resource_group }}
run: az webapp stop --name "$RESOURCE_NAME" --resource-group "$RESOURCE_GROUP"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Stop Azure Web App workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "stop_azure_webapp",
"title": "Stop Azure Web App",
"icon": "Azure",
"description": "Stop a running Azure web app. Use when a user asks to stop or take down an Azure App Service web app. Requires the Azure web app entity.",
"category": "Azure cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Stop Azure web app",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "azure_web_app"
}
],
"userInputs": {
"properties": {
"azure_web_app": {
"title": "Web App",
"description": "The running Azure web app to stop",
"type": "string",
"format": "entity",
"blueprint": "azureWebApp",
"icon": "Azure"
}
},
"required": [
"azure_web_app"
],
"order": [
"azure_web_app"
]
}
}
},
{
"identifier": "dispatch_stop",
"title": "Stop Azure web app",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "stop-azure-webapp.yaml",
"workflowInputs": {
"resource_name": "{{ .outputs.trigger.azure_web_app | split(\"/\") | last }}",
"resource_group": "{{ .outputs.trigger.azure_web_app | split(\"/\") | .[4] }}",
"subscription_id": "{{ .outputs.trigger.azure_web_app | split(\"/\") | .[2] }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_stop"
}
]
}

You can run Stop Azure Web App from Self-service or from the bolt menu on an azureWebApp entity.

Restart an Azure web app​

To restart an Azure web app from Port, first add a GitHub Actions workflow that restarts the web app in Azure. Then create a Port workflow that dispatches it.

Add GitHub workflow

Create the file .github/workflows/restart-azure-webapp.yaml in the .github/workflows folder of your repository.

Restart Azure Web App GitHub workflow (click to expand)
name: Restart Azure Web App

on:
workflow_dispatch:
inputs:
resource_name:
description: 'Web App name'
required: true
type: string
resource_group:
description: 'Azure resource group name'
required: true
type: string
subscription_id:
description: 'Azure subscription ID'
required: true
type: string

jobs:
restart-webapp:
runs-on: ubuntu-latest
steps:
- name: Azure Login
uses: azure/login@v2
env:
AZURE_LOGIN_PRE_CLEANUP: true
AZURE_LOGIN_POST_CLEANUP: true
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ inputs.subscription_id }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'

- name: Restart Azure Web App
env:
RESOURCE_NAME: ${{ inputs.resource_name }}
RESOURCE_GROUP: ${{ inputs.resource_group }}
run: az webapp restart --name "$RESOURCE_NAME" --resource-group "$RESOURCE_GROUP"
Create Port workflow
  1. Go to the workflows page in Port.
  2. Click + Workflow.
  3. Fill out the Create new workflow form, then click Confirm.
  4. Click the {...} button to open the JSON editor and paste the workflow JSON below.
  5. Click Apply changes.
Restart Azure Web App workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub Ocean installation ID. Go to the Connectors page, find your GitHub Ocean integration, and click Manage. The ID is shown at the top of the panel (finding your installation ID).
  • <GITHUB_ORG> - your GitHub organization or user name.
  • <GITHUB_REPO> - your GitHub repository name.
{
"identifier": "restart_azure_webapp",
"title": "Restart Azure Web App",
"icon": "Azure",
"description": "Restart a running Azure web app. Use when a user asks to restart or reboot an Azure App Service web app. Requires the Azure web app entity.",
"category": "Azure cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Restart Azure web app",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "azure_web_app"
}
],
"userInputs": {
"properties": {
"azure_web_app": {
"title": "Web App",
"description": "The running Azure web app to restart",
"type": "string",
"format": "entity",
"blueprint": "azureWebApp",
"icon": "Azure"
}
},
"required": [
"azure_web_app"
],
"order": [
"azure_web_app"
]
}
}
},
{
"identifier": "dispatch_restart",
"title": "Restart Azure web app",
"icon": "Github",
"config": {
"type": "INTEGRATION_ACTION",
"installationId": "<GITHUB_OCEAN_INSTALLATION_ID>",
"integrationProvider": "github-ocean",
"integrationInvocationType": "dispatch_workflow",
"integrationActionExecutionProperties": {
"org": "<GITHUB_ORG>",
"repo": "<GITHUB_REPO>",
"workflow": "restart-azure-webapp.yaml",
"workflowInputs": {
"resource_name": "{{ .outputs.trigger.azure_web_app | split(\"/\") | last }}",
"resource_group": "{{ .outputs.trigger.azure_web_app | split(\"/\") | .[4] }}",
"subscription_id": "{{ .outputs.trigger.azure_web_app | split(\"/\") | .[2] }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_restart"
}
]
}

You can run Restart Azure Web App from Self-service or from the bolt menu on an azureWebApp entity.

Visualize web app metrics​

With your data and workflows in place, we can create a dedicated dashboard in Port to visualize all Azure web apps by status, location, and resource group. We can also trigger start, stop, and restart workflows directly from the dashboard.

Create a dashboard​

  1. Navigate to your software catalog.
  2. Click on the + button in the left sidebar.
  3. Select New dashboard.
  4. Name the dashboard Azure Web App Management.
  5. Input Monitor and manage your Azure web apps under Description.
  6. Select the Azure icon.
  7. Click Create.

We now have a blank dashboard where we can start adding widgets to visualize insights from our Azure web apps.

Add widgets​

In the new dashboard, create the following widgets:

Total web apps (click to expand)
  1. Click + Widget and select Number Chart.
  2. Title: Total web apps (add the Azure icon).
  3. Select Count entities Chart type and choose Web App as the Blueprint.
  4. Select count for the Function.
  5. Select custom as the Unit and input web apps as the Custom unit.
  6. Click Save.
Web apps by state (click to expand)
  1. Click + Widget and select Pie chart.
  2. Title: Web apps by state (add the Azure icon).
  3. Choose the Web App blueprint.
  4. Under Breakdown by property, select the State property.
  5. Click Save.
Web apps by location (click to expand)
  1. Click + Widget and select Pie chart.
  2. Title: Web apps by location (add the Azure icon).
  3. Choose the Web App blueprint.
  4. Under Breakdown by property, select the Location property.
  5. Click Save.
All web apps table (click to expand)
  1. Click + Widget and select Table.

  2. Title: All web apps (add the Azure icon).

  3. Choose the Web App blueprint.

  4. Click Save to add the widget to the dashboard.

  5. Click on the ... button in the top right corner of the table and select Customize table.

  6. In the top right corner of the table, click on Manage Properties and add the following properties:

    • Title: The web app name.
    • State: The current state of the web app.
    • Location: The Azure region where the web app is deployed.
    • Enabled: Whether the web app is enabled.
    • Default Host Name: The default hostname of the web app.
    • Resource Group: The name of each related Azure resource group.
  7. Click on the save icon in the top right corner of the widget to save the customized table.

Manage web apps workflow card (click to expand)
  1. Click + Widget and select Workflow card (learn more).
  2. Under Workflows, choose the Start Azure Web App, Stop Azure Web App, and Restart Azure Web App workflows we created in this guide.
  3. Title: Manage web apps (add the Azure icon).
  4. Click Save.

More relevant guides​