> 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 GCP Compute Engine instances section uses self-service actions. All other sections use Port workflows.

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, and run request, renew, and delete certificate workflows.
AWS Auto Scaling GroupsMonitor capacity and scaling configuration, then scale and resize Auto Scaling Groups with workflows.
AWS SQS queuesMonitor queue health, and run purge, DLQ redrive, and delete queue workflows.
AWS ECS servicesMonitor ECS services, then scale, restart, update task definitions, run health checks, roll back deployments, and delete services through Port workflows.
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.
  • Port's AWS integration is installed in your account.
  • Port's GitHub integration is installed for running workflows.
  • 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 integration. These workflows let users:

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

The request workflow is a global self-service form because it does not target an existing 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. A dataset filter on the entity input shows Renew only for certificates that are eligible for renewal and Delete only for certificates that are not in use.

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. Operations use the AWS_REGION repository secret. Grant these permissions in that region, or use credentials that cover every region where you manage certificates.

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 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:
description: 'Fully qualified domain name (FQDN) to secure with the certificate'
required: true
type: string
validation_method:
description: 'Domain validation method (DNS or EMAIL)'
required: true
default: 'DNS'
type: string

jobs:
request-acm-certificate:
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
env:
DOMAIN_NAME: ${{ inputs.domain_name }}
VALIDATION_METHOD: ${{ inputs.validation_method }}
run: |
aws acm request-certificate \
--domain-name "$DOMAIN_NAME" \
--validation-method "$VALIDATION_METHOD"
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.
Request ACM Certificate workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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": "request_acm_certificate",
"title": "Request ACM Certificate",
"icon": "AWS",
"description": "Request a new public AWS ACM certificate for a domain name. Use when a user asks to request, issue, or create an ACM or TLS certificate for a domain. Requires the domain name and validation method.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Request ACM certificate",
"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",
"type": "string",
"title": "Validation Method",
"description": "How you will prove that you own or control the domain",
"default": "DNS",
"enum": [
"DNS",
"EMAIL"
],
"enumColors": {
"DNS": "lightGray",
"EMAIL": "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": "<GITHUB_OCEAN_INSTALLATION_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 Self-service. After the request, complete the DNS or email validation so that ACM can issue the certificate.

Renew an ACM certificate​

To renew an ACM certificate from Port, first add a GitHub Actions workflow that renews the certificate 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:
certificate_arn:
description: 'ACM certificate ARN (Port entity identifier)'
required: true
type: string

jobs:
renew-acm-certificate:
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
env:
CERTIFICATE_ARN: ${{ inputs.certificate_arn }}
run: aws acm renew-certificate --certificate-arn "$CERTIFICATE_ARN"
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.
Renew ACM Certificate workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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": "renew_acm_certificate",
"title": "Renew ACM Certificate",
"icon": "AWS",
"description": "Renew an AWS ACM certificate that is eligible for renewal. Use when a user asks to renew an ACM certificate. Requires the ACM certificate entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Renew ACM certificate",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "acm_certificate"
}
],
"userInputs": {
"properties": {
"acm_certificate": {
"title": "ACM Certificate",
"description": "The ACM certificate to renew. Only certificates that are eligible for renewal are shown.",
"type": "string",
"format": "entity",
"blueprint": "acmCertificate",
"icon": "AWS",
"dataset": {
"combinator": "and",
"rules": [
{
"property": "renewalEligibility",
"operator": "=",
"value": "ELIGIBLE"
}
]
}
}
},
"required": [
"acm_certificate"
],
"order": [
"acm_certificate"
]
}
}
},
{
"identifier": "dispatch_renew",
"title": "Renew ACM certificate",
"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": "renew-acm-cert.yaml",
"workflowInputs": {
"certificate_arn": "{{ .outputs.trigger.acm_certificate }}",
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_renew"
}
]
}

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

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:
certificate_arn:
description: 'ACM certificate ARN (Port entity identifier)'
required: true
type: string

jobs:
delete-acm-certificate:
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
env:
CERTIFICATE_ARN: ${{ inputs.certificate_arn }}
run: aws acm delete-certificate --certificate-arn "$CERTIFICATE_ARN"
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 ACM Certificate workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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_acm_certificate",
"title": "Delete ACM Certificate",
"icon": "AWS",
"description": "Permanently delete an unused AWS ACM certificate and its private key after admin approval. Use only when a user explicitly asks to delete an ACM certificate. Requires the ACM certificate entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Delete ACM certificate",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "acm_certificate"
}
],
"userInputs": {
"properties": {
"acm_certificate": {
"title": "ACM Certificate",
"description": "The ACM certificate to delete. Certificates that are in use by other AWS services cannot be deleted.",
"type": "string",
"format": "entity",
"blueprint": "acmCertificate",
"icon": "AWS",
"dataset": {
"combinator": "and",
"rules": [
{
"property": "inUse",
"operator": "!=",
"value": true
}
]
}
}
},
"required": [
"acm_certificate"
],
"order": [
"acm_certificate"
]
},
"variant": "ALERT"
}
},
{
"identifier": "approval",
"title": "Approve request",
"config": {
"type": "INPUT",
"description": "Approve deleting ACM certificate {{ .outputs.trigger.acm_certificate }}, 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 ACM certificate",
"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-acm-cert.yaml",
"workflowInputs": {
"certificate_arn": "{{ .outputs.trigger.acm_certificate }}",
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "approval"
},
{
"sourceIdentifier": "approval",
"targetIdentifier": "dispatch_delete",
"sourceOutletIdentifier": "approve"
}
]
}

You can run Delete ACM Certificate from Self-service or from the bolt menu on an acmCertificate entity that is not in use.

Approval before deletion

This workflow uses the ALERT trigger variant and an input node that waits for a user with the Admin role to approve the request. Deleting a certificate permanently removes the certificate and its private key, and 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 run workflows (request new certificate, 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 Initial 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 Initial 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 card (click to expand)
  1. Click + Widget and select Workflow card (learn more).
  2. Under Workflows, choose the Request ACM Certificate workflow we created in this guide.
  3. Title: Request new certificate (add the AWS icon).
  4. 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 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 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 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 installation ID. Go to the Connectors page, find your GitHub 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 installation ID. Go to the Connectors page, find your GitHub 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, you 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.
  • Port's AWS integration is installed in your account.
  • Port's GitHub integration is installed for running workflows.
  • 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 integration. These workflows let users:

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

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

The sqs entity identifier has the format <region>-<account ID>-<queue name> (see the mapping above). Each workflow derives the queue URL and queue ARNs from that identifier with JQ, so no extra lookup is needed. The AWS_REGION repository secret sets the AWS region for GitHub Actions.

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 sqs:PurgeQueue and sqs:DeleteQueue on the queues it manages. To redrive messages, it needs sqs:StartMessageMoveTask, sqs:ReceiveMessage, sqs:DeleteMessage, and sqs:GetQueueAttributes on the dead-letter queue, and sqs:SendMessage on the destination queue. For encrypted queues, it also needs kms:Decrypt on the dead-letter queue's key, and kms:GenerateDataKey and kms:Decrypt on the destination queue's key.

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 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:
queue_url:
description: 'URL of the SQS queue to purge'
required: true
type: string

jobs:
purge-sqs-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
env:
QUEUE_URL: ${{ inputs.queue_url }}
run: aws sqs purge-queue --queue-url "$QUEUE_URL"
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.
Purge SQS Queue workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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": "purge_sqs_queue",
"title": "Purge SQS Queue",
"icon": "AWS",
"description": "Permanently delete all messages in an AWS SQS queue after admin approval. Use only when a user explicitly asks to purge or clear an SQS queue. Requires the SQS queue entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Purge SQS queue",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "sqs_queue"
}
],
"userInputs": {
"properties": {
"sqs_queue": {
"title": "SQS Queue",
"description": "The SQS queue to purge. All messages in the queue are deleted.",
"type": "string",
"format": "entity",
"blueprint": "sqs",
"icon": "AWS"
}
},
"required": [
"sqs_queue"
],
"order": [
"sqs_queue"
]
},
"variant": "ALERT"
}
},
{
"identifier": "approval",
"title": "Approve request",
"config": {
"type": "INPUT",
"description": "Approve purging all messages from SQS queue {{ .outputs.trigger.sqs_queue }}, 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_purge",
"title": "Purge SQS queue",
"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": "purge-queue.yaml",
"workflowInputs": {
"queue_url": "{{ .outputs.trigger.sqs_queue | capture(\"^(?<region>.+?)-(?<account>[0-9]{12})-(?<name>.+)$\") | \"https://sqs.\" + .region + \".amazonaws.com/\" + .account + \"/\" + .name }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "approval"
},
{
"sourceIdentifier": "approval",
"targetIdentifier": "dispatch_purge",
"sourceOutletIdentifier": "approve"
}
]
}

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

Approval before purging

Purging permanently deletes all messages in the queue and cannot be undone. This workflow uses the ALERT trigger variant and an input node that waits for a user with the Admin role to approve the request.

Redrive messages from a DLQ​

To redrive messages from a dead-letter queue from Port, first add a GitHub Actions workflow that starts a message move task 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_arn:
description: 'ARN of the dead-letter queue to move messages from'
required: true
type: string
destination_arn:
description: 'ARN of the queue that receives the messages'
required: true
type: string
max_messages_per_second:
description: 'Maximum number of messages to move per second (1-500)'
required: true
default: '100'
type: string

jobs:
redrive-dlq-messages:
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 message move task
env:
SOURCE_ARN: ${{ inputs.source_arn }}
DESTINATION_ARN: ${{ inputs.destination_arn }}
MAX_MESSAGES_PER_SECOND: ${{ inputs.max_messages_per_second }}
run: |
aws sqs start-message-move-task \
--source-arn "$SOURCE_ARN" \
--destination-arn "$DESTINATION_ARN" \
--max-number-of-messages-per-second "$MAX_MESSAGES_PER_SECOND"
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.
Redrive SQS DLQ messages workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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": "redrive_sqs_dlq",
"title": "Redrive SQS DLQ Messages",
"icon": "AWS",
"description": "Move messages from an AWS SQS dead-letter queue (DLQ) to a destination queue. Use when a user asks to redrive, replay, or move messages out of a DLQ. Requires the DLQ entity and the destination queue entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Redrive SQS DLQ messages",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "sqs_queue"
}
],
"userInputs": {
"properties": {
"sqs_queue": {
"title": "Dead-letter queue",
"description": "The dead-letter queue (DLQ) to move messages from",
"type": "string",
"format": "entity",
"blueprint": "sqs",
"icon": "AWS"
},
"destination_queue": {
"title": "Destination queue",
"description": "The queue that receives the redriven messages",
"type": "string",
"format": "entity",
"blueprint": "sqs",
"icon": "AWS"
},
"max_messages_per_second": {
"type": "number",
"title": "Max messages per second",
"description": "Maximum number of messages to move per second (1-500)",
"default": 100,
"minimum": 1,
"maximum": 500
}
},
"required": [
"sqs_queue",
"destination_queue",
"max_messages_per_second"
],
"order": [
"sqs_queue",
"destination_queue",
"max_messages_per_second"
]
}
}
},
{
"identifier": "dispatch_redrive",
"title": "Redrive DLQ messages",
"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": "redrive-queue.yaml",
"workflowInputs": {
"source_arn": "{{ .outputs.trigger.sqs_queue | capture(\"^(?<region>.+?)-(?<account>[0-9]{12})-(?<name>.+)$\") | \"arn:aws:sqs:\" + .region + \":\" + .account + \":\" + .name }}",
"destination_arn": "{{ .outputs.trigger.destination_queue | capture(\"^(?<region>.+?)-(?<account>[0-9]{12})-(?<name>.+)$\") | \"arn:aws:sqs:\" + .region + \":\" + .account + \":\" + .name }}",
"max_messages_per_second": "{{ .outputs.trigger.max_messages_per_second | tostring }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_redrive"
}
]
}

You can run Redrive SQS DLQ Messages from Self-service or from the bolt menu on an sqs entity. Select the dead-letter queue and the destination queue, then set the maximum number of 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:
queue_url:
description: 'URL of the SQS queue to delete'
required: true
type: string

jobs:
delete-sqs-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
env:
QUEUE_URL: ${{ inputs.queue_url }}
run: aws sqs delete-queue --queue-url "$QUEUE_URL"
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 SQS Queue workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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_sqs_queue",
"title": "Delete SQS Queue",
"icon": "AWS",
"description": "Permanently delete an AWS SQS queue and all of its messages after admin approval. Use only when a user explicitly asks to delete an SQS queue. Requires the SQS queue entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Delete SQS queue",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "sqs_queue"
}
],
"userInputs": {
"properties": {
"sqs_queue": {
"title": "SQS Queue",
"description": "The SQS queue to delete. The queue and all of its messages are deleted.",
"type": "string",
"format": "entity",
"blueprint": "sqs",
"icon": "AWS"
}
},
"required": [
"sqs_queue"
],
"order": [
"sqs_queue"
]
},
"variant": "ALERT"
}
},
{
"identifier": "approval",
"title": "Approve request",
"config": {
"type": "INPUT",
"description": "Approve deleting SQS queue {{ .outputs.trigger.sqs_queue }}, 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 SQS queue",
"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-queue.yaml",
"workflowInputs": {
"queue_url": "{{ .outputs.trigger.sqs_queue | capture(\"^(?<region>.+?)-(?<account>[0-9]{12})-(?<name>.+)$\") | \"https://sqs.\" + .region + \".amazonaws.com/\" + .account + \"/\" + .name }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "approval"
},
{
"sourceIdentifier": "approval",
"targetIdentifier": "dispatch_delete",
"sourceOutletIdentifier": "approve"
}
]
}

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

Approval before deletion

This workflow uses the ALERT trigger variant and an input node that waits for a user with the Admin role to approve the request. Deleting a queue also deletes all of its messages, and 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. You can also run the purge, redrive, and delete workflows from the bolt menu on queues in the dashboard tables.

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 Initial 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 using workflows.

In this section, you will:

  • Ingest ECS cluster and service data into Port's context lake using Port's AWS integration.
  • Set up workflows 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.
  • Port's GitHub integration is installed for running workflows.
  • 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.

ECS Management dashboard with service workflows AWS ECS Service 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 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 workflows​

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

  1. Scale ECS service tasks up or down.
  2. Restart an ECS service.
  3. Update task definitions with new container images.
  4. Run health checks and diagnostics.
  5. Roll back deployments to previous versions.
  6. Delete ECS services.

Each workflow uses an entity-context self-service trigger so it appears both on the Self-service page and in the bolt (⚡) menu on awsEcsService entities. The workflows take the service ARN from the entity identifier and derive the cluster name from it. The AWS_REGION repository secret sets the AWS region for the GitHub Actions workflows. Cluster parsing assumes the long ECS service ARN format (arn:aws:ecs:<region>:<account-id>:service/<cluster-name>/<service-name>).

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 ecs:DescribeServices, ecs:UpdateService, ecs:ListTasks, ecs:DescribeTasks, ecs:DescribeTaskDefinition, ecs:RegisterTaskDefinition, and ecs:DeleteService permissions. To register a task definition that uses a task role or a task execution role, the user also needs iam:PassRole on those roles.

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 integration. Keep AWS credentials in GitHub repository secrets, not in the Port workflow JSON.

Scale ECS service​

To scale an ECS service from Port, first add a GitHub Actions workflow that updates the desired task count in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

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

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

on:
workflow_dispatch:
inputs:
service_arn:
description: 'ECS service ARN (Port entity identifier)'
required: true
type: string
cluster:
description: 'ECS cluster name'
required: true
type: string
desired_count:
description: 'New desired task count'
required: true
type: string

jobs:
scale-ecs-service:
runs-on: ubuntu-latest
env:
SERVICE_ARN: ${{ inputs.service_arn }}
CLUSTER: ${{ inputs.cluster }}
DESIRED_COUNT: ${{ inputs.desired_count }}
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 ECS service
run: |
if ! [[ "$DESIRED_COUNT" =~ ^[0-9]+$ ]]; then
echo "Invalid desired count: $DESIRED_COUNT"
exit 1
fi
aws ecs update-service \
--cluster "$CLUSTER" \
--service "$SERVICE_ARN" \
--desired-count "$DESIRED_COUNT"

- name: Wait for service to stabilize
run: |
aws ecs wait services-stable \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN"
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 ECS Service workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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_ecs_service",
"title": "Scale ECS Service",
"icon": "AWS",
"description": "Set the desired task count of an AWS ECS service. Use when a user asks to scale an ECS service up or down or change how many tasks it runs. Requires the ECS service entity and the new desired count.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Scale ECS service",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "ecs_service"
}
],
"userInputs": {
"properties": {
"ecs_service": {
"title": "ECS Service",
"description": "The ECS service to scale",
"type": "string",
"format": "entity",
"blueprint": "awsEcsService",
"icon": "AWS"
},
"desired_count": {
"title": "Desired Count",
"description": "Number of tasks the service should run",
"type": "number",
"minimum": 0,
"maximum": 100,
"default": 1
}
},
"required": [
"ecs_service",
"desired_count"
],
"order": [
"ecs_service",
"desired_count"
]
}
}
},
{
"identifier": "dispatch_scale",
"title": "Scale ECS service",
"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-ecs-service.yml",
"workflowInputs": {
"service_arn": "{{ .outputs.trigger.ecs_service }}",
"cluster": "{{ .outputs.trigger.ecs_service | split(\"/\") | .[1] }}",
"desired_count": "{{ .outputs.trigger.desired_count | tostring }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_scale"
}
]
}

You can run Scale ECS Service from Self-service or from the bolt menu on an awsEcsService entity.

Restart ECS service​

To restart an ECS service from Port, first add a GitHub Actions workflow that forces a new deployment in AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

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

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

on:
workflow_dispatch:
inputs:
service_arn:
description: 'ECS service ARN (Port entity identifier)'
required: true
type: string
cluster:
description: 'ECS cluster name'
required: true
type: string

jobs:
restart-ecs-service:
runs-on: ubuntu-latest
env:
SERVICE_ARN: ${{ inputs.service_arn }}
CLUSTER: ${{ inputs.cluster }}
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: Force new deployment
run: |
aws ecs update-service \
--cluster "$CLUSTER" \
--service "$SERVICE_ARN" \
--force-new-deployment

- name: Wait for deployment to complete
run: |
aws ecs wait services-stable \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN"
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 ECS Service workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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_ecs_service",
"title": "Restart ECS Service",
"icon": "AWS",
"description": "Restart an AWS ECS service by forcing a new deployment that replaces its running tasks. Use when a user asks to restart, redeploy, or recycle the tasks of an ECS service. Requires the ECS service entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Restart ECS service",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "ecs_service"
}
],
"userInputs": {
"properties": {
"ecs_service": {
"title": "ECS Service",
"description": "The ECS service to restart",
"type": "string",
"format": "entity",
"blueprint": "awsEcsService",
"icon": "AWS"
}
},
"required": [
"ecs_service"
],
"order": [
"ecs_service"
]
}
}
},
{
"identifier": "dispatch_restart",
"title": "Restart ECS service",
"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-ecs-service.yml",
"workflowInputs": {
"service_arn": "{{ .outputs.trigger.ecs_service }}",
"cluster": "{{ .outputs.trigger.ecs_service | split(\"/\") | .[1] }}",
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_restart"
}
]
}

You can run Restart ECS Service from Self-service or from the bolt menu on an awsEcsService entity.

Update task definition​

To update an ECS task definition from Port, first add a GitHub Actions workflow that registers a new task definition revision with the new image and updates the service. Then create a Port workflow that dispatches it.

Add GitHub workflow

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

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

on:
workflow_dispatch:
inputs:
service_arn:
description: 'ECS service ARN (Port entity identifier)'
required: true
type: string
cluster:
description: 'ECS cluster name'
required: true
type: string
image_uri:
description: 'New container image URI'
required: true
type: string

jobs:
update-task-definition:
runs-on: ubuntu-latest
env:
SERVICE_ARN: ${{ inputs.service_arn }}
CLUSTER: ${{ inputs.cluster }}
IMAGE_URI: ${{ inputs.image_uri }}
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: Register task definition with new image
id: register
run: |
TASK_DEF_ARN=$(aws ecs describe-services \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN" \
--query 'services[0].taskDefinition' \
--output text)
echo "Current task definition: $TASK_DEF_ARN"

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

# Replace the image of the first container and drop the read-only fields
jq --arg image "$IMAGE_URI" \
'.containerDefinitions[0].image = $image
| del(.taskDefinitionArn, .revision, .status, .requiresAttributes, .compatibilities, .registeredAt, .registeredBy, .deregisteredAt)' \
current-task-def.json > new-task-def.json

NEW_TASK_DEF_ARN=$(aws ecs register-task-definition \
--cli-input-json file://new-task-def.json \
--query 'taskDefinition.taskDefinitionArn' \
--output text)
echo "Registered task definition: $NEW_TASK_DEF_ARN"
echo "new_task_def_arn=$NEW_TASK_DEF_ARN" >> "$GITHUB_OUTPUT"

- name: Update service with new task definition
env:
NEW_TASK_DEF_ARN: ${{ steps.register.outputs.new_task_def_arn }}
run: |
aws ecs update-service \
--cluster "$CLUSTER" \
--service "$SERVICE_ARN" \
--task-definition "$NEW_TASK_DEF_ARN"

- name: Wait for deployment to complete
run: |
aws ecs wait services-stable \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN"
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.
Update Task Definition workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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": "update_task_definition",
"title": "Update Task Definition",
"icon": "AWS",
"description": "Deploy a new container image to an AWS ECS service by registering a new task definition revision and updating the service to use it. Use when a user asks to deploy or roll out a new image version to an ECS service. Requires the ECS service entity and the full image URI.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Update task definition",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "ecs_service"
}
],
"userInputs": {
"properties": {
"ecs_service": {
"title": "ECS Service",
"description": "The ECS service to deploy the new image to",
"type": "string",
"format": "entity",
"blueprint": "awsEcsService",
"icon": "AWS"
},
"image_uri": {
"title": "Container Image URI",
"description": "Full URI of the new container image (for example, 123456789012.dkr.ecr.us-east-1.amazonaws.com/repo:tag). It replaces the image of the first container in the task definition.",
"type": "string",
"pattern": "^.+:.+$"
}
},
"required": [
"ecs_service",
"image_uri"
],
"order": [
"ecs_service",
"image_uri"
]
}
}
},
{
"identifier": "dispatch_update",
"title": "Update task definition",
"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": "update-task-definition.yml",
"workflowInputs": {
"service_arn": "{{ .outputs.trigger.ecs_service }}",
"cluster": "{{ .outputs.trigger.ecs_service | split(\"/\") | .[1] }}",
"image_uri": "{{ .outputs.trigger.image_uri }}"
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_update"
}
]
}

You can run Update Task Definition from Self-service or from the bolt menu on an awsEcsService entity. The GitHub workflow replaces the image of the first container in the task definition. For task definitions with several containers, adjust the jq filter to target the container you want to update.

Run service health check​

To run an ECS service health check from Port, first add a GitHub Actions workflow that gathers the service diagnostics from AWS. Then create a Port workflow that dispatches it.

Add GitHub workflow

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

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

on:
workflow_dispatch:
inputs:
service_arn:
description: 'ECS service ARN (Port entity identifier)'
required: true
type: string
cluster:
description: 'ECS cluster name'
required: true
type: string

jobs:
health-check:
runs-on: ubuntu-latest
env:
SERVICE_ARN: ${{ inputs.service_arn }}
CLUSTER: ${{ inputs.cluster }}
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: Check service status
run: |
read -r SERVICE_STATUS RUNNING_COUNT DESIRED_COUNT < <(aws ecs describe-services \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN" \
--query 'services[0].[status, runningCount, desiredCount]' \
--output text)

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"
else
echo "Service needs attention"
fi

- name: Check running tasks
run: |
TASK_ARNS=$(aws ecs list-tasks \
--cluster "$CLUSTER" \
--service-name "${SERVICE_ARN##*/}" \
--query 'taskArns' \
--output text)

if [ -n "$TASK_ARNS" ] && [ "$TASK_ARNS" != "None" ]; then
# TASK_ARNS is intentionally unquoted so each ARN is passed as a separate argument
aws ecs describe-tasks \
--cluster "$CLUSTER" \
--tasks $TASK_ARNS \
--query 'tasks[].[taskArn, lastStatus, healthStatus]' \
--output table
else
echo "No running tasks found"
fi

- name: Show recent service events
run: |
aws ecs describe-services \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN" \
--query 'services[0].events[:10].[createdAt, message]' \
--output table
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.
Service Health Check workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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": "service_health_check",
"title": "Service Health Check",
"icon": "AWS",
"description": "Report the status, running and desired task counts, tasks, and recent events of an AWS ECS service. Use when a user asks whether an ECS service is healthy or wants to diagnose it. Read-only. Requires the ECS service entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Run ECS service health check",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "ecs_service"
}
],
"userInputs": {
"properties": {
"ecs_service": {
"title": "ECS Service",
"description": "The ECS service to check",
"type": "string",
"format": "entity",
"blueprint": "awsEcsService",
"icon": "AWS"
}
},
"required": [
"ecs_service"
],
"order": [
"ecs_service"
]
}
}
},
{
"identifier": "dispatch_health_check",
"title": "Run health check",
"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": "service-health-check.yml",
"workflowInputs": {
"service_arn": "{{ .outputs.trigger.ecs_service }}",
"cluster": "{{ .outputs.trigger.ecs_service | split(\"/\") | .[1] }}",
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "dispatch_health_check"
}
]
}

You can run Service Health Check from Self-service or from the bolt menu on an awsEcsService entity. The results appear in the logs of the GitHub Actions run.

Roll back deployment​

To roll back an ECS deployment from Port, first add a GitHub Actions workflow that restores the previous task definition revision. Then create a Port workflow that dispatches it.

Add GitHub workflow

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

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

on:
workflow_dispatch:
inputs:
service_arn:
description: 'ECS service ARN (Port entity identifier)'
required: true
type: string
cluster:
description: 'ECS cluster name'
required: true
type: string

jobs:
rollback-deployment:
runs-on: ubuntu-latest
env:
SERVICE_ARN: ${{ inputs.service_arn }}
CLUSTER: ${{ inputs.cluster }}
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: Find previous task definition revision
id: previous
run: |
CURRENT_TASK_DEF=$(aws ecs describe-services \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN" \
--query 'services[0].taskDefinition' \
--output text)
echo "Current task definition: $CURRENT_TASK_DEF"

FAMILY_REVISION="${CURRENT_TASK_DEF##*/}"
FAMILY="${FAMILY_REVISION%:*}"
CURRENT_REVISION="${FAMILY_REVISION##*:}"
PREVIOUS_REVISION=$((CURRENT_REVISION - 1))

if [ "$PREVIOUS_REVISION" -lt 1 ]; then
echo "No previous revision to roll back to"
exit 1
fi

PREVIOUS_TASK_DEF="$FAMILY:$PREVIOUS_REVISION"
PREVIOUS_STATUS=$(aws ecs describe-task-definition \
--task-definition "$PREVIOUS_TASK_DEF" \
--query 'taskDefinition.status' \
--output text 2>/dev/null || echo "MISSING")

# A service can't be updated to an INACTIVE (deregistered) revision
if [ "$PREVIOUS_STATUS" != "ACTIVE" ]; then
echo "Task definition $PREVIOUS_TASK_DEF is $PREVIOUS_STATUS and can't be used for a rollback"
exit 1
fi

echo "Rolling back to: $PREVIOUS_TASK_DEF"
echo "task_def=$PREVIOUS_TASK_DEF" >> "$GITHUB_OUTPUT"

- name: Roll back service
env:
PREVIOUS_TASK_DEF: ${{ steps.previous.outputs.task_def }}
run: |
aws ecs update-service \
--cluster "$CLUSTER" \
--service "$SERVICE_ARN" \
--task-definition "$PREVIOUS_TASK_DEF"

- name: Wait for rollback to complete
run: |
aws ecs wait services-stable \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN"
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.
Rollback Deployment workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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": "rollback_deployment",
"title": "Rollback Deployment",
"icon": "AWS",
"description": "Roll an AWS ECS service back to the previous revision of its task definition after admin approval. Use when a user asks to roll back or revert the latest deployment of an ECS service. Requires the ECS service entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Roll back ECS deployment",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "ecs_service"
}
],
"userInputs": {
"properties": {
"ecs_service": {
"title": "ECS Service",
"description": "The ECS service to roll back to its previous task definition revision",
"type": "string",
"format": "entity",
"blueprint": "awsEcsService",
"icon": "AWS"
}
},
"required": [
"ecs_service"
],
"order": [
"ecs_service"
]
},
"variant": "ALERT"
}
},
{
"identifier": "approval",
"title": "Approve request",
"config": {
"type": "INPUT",
"description": "Approve rolling back ECS service {{ .outputs.trigger.ecs_service }} to its previous task definition revision, 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_rollback",
"title": "Rollback deployment",
"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": "rollback-deployment.yml",
"workflowInputs": {
"service_arn": "{{ .outputs.trigger.ecs_service }}",
"cluster": "{{ .outputs.trigger.ecs_service | split(\"/\") | .[1] }}",
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "approval"
},
{
"sourceIdentifier": "approval",
"targetIdentifier": "dispatch_rollback",
"sourceOutletIdentifier": "approve"
}
]
}

You can run Rollback Deployment from Self-service or from the bolt menu on an awsEcsService entity.

Approval before rollback

Rolling back can affect production traffic, so this workflow uses the ALERT trigger variant and an input node that waits for a user with the Admin role to approve the request. The GitHub workflow rolls back to the revision just before the current one, and fails if that revision has been deregistered.

Delete ECS service​

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

Add GitHub workflow

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

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

on:
workflow_dispatch:
inputs:
service_arn:
description: 'ECS service ARN (Port entity identifier)'
required: true
type: string
cluster:
description: 'ECS cluster name'
required: true
type: string

jobs:
delete-ecs-service:
runs-on: ubuntu-latest
env:
SERVICE_ARN: ${{ inputs.service_arn }}
CLUSTER: ${{ inputs.cluster }}
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 service to zero
run: |
aws ecs update-service \
--cluster "$CLUSTER" \
--service "$SERVICE_ARN" \
--desired-count 0

aws ecs wait services-stable \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN"

- name: Delete the service
run: |
aws ecs delete-service \
--cluster "$CLUSTER" \
--service "$SERVICE_ARN" \
--force

- name: Wait for deletion to complete
run: |
aws ecs wait services-inactive \
--cluster "$CLUSTER" \
--services "$SERVICE_ARN"
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 ECS Service workflow (click to expand)
Replace the placeholders
  • <GITHUB_OCEAN_INSTALLATION_ID> - your GitHub installation ID. Go to the Connectors page, find your GitHub 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_ecs_service",
"title": "Delete ECS Service",
"icon": "AWS",
"description": "Permanently delete an AWS ECS service after admin approval, scaling it to zero tasks first. Use only when a user explicitly asks to delete an ECS service. Requires the ECS service entity.",
"category": "AWS cloud resources",
"nodes": [
{
"identifier": "trigger",
"title": "Delete ECS service",
"config": {
"type": "SELF_SERVE_TRIGGER",
"contexts": [
{
"on": "ENTITY",
"userInput": "ecs_service"
}
],
"userInputs": {
"properties": {
"ecs_service": {
"title": "ECS Service",
"description": "The ECS service to delete. Its tasks are stopped and the service is removed.",
"type": "string",
"format": "entity",
"blueprint": "awsEcsService",
"icon": "AWS"
}
},
"required": [
"ecs_service"
],
"order": [
"ecs_service"
]
},
"variant": "ALERT"
}
},
{
"identifier": "approval",
"title": "Approve request",
"config": {
"type": "INPUT",
"description": "Approve deleting ECS service {{ .outputs.trigger.ecs_service }}, 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 ECS service",
"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-ecs-service.yml",
"workflowInputs": {
"service_arn": "{{ .outputs.trigger.ecs_service }}",
"cluster": "{{ .outputs.trigger.ecs_service | split(\"/\") | .[1] }}",
},
"reportWorkflowStatus": true
}
}
}
],
"connections": [
{
"sourceIdentifier": "trigger",
"targetIdentifier": "approval"
},
{
"sourceIdentifier": "approval",
"targetIdentifier": "dispatch_delete",
"sourceOutletIdentifier": "approve"
}
]
}

You can run Delete ECS Service from Self-service or from the bolt menu on an awsEcsService entity.

Approval before deletion

Like the terminate EC2 and delete RDS workflows, this workflow uses the ALERT trigger variant and an input node that waits for a user with the Admin role to approve the request. The GitHub workflow scales the service to zero tasks before deleting it. The service entity is removed from Port on the next AWS integration resync.

Let's test it!​

Now that you have set up the workflows, let's test them with your ECS services.

  1. Head to the Self-service page in Port.
  2. Service Health Check
    • Click on the Service Health Check workflow.
    • Choose any ECS service from your catalog.
    • Click Execute.
    • Check the health summary in the logs of the GitHub Actions run.
  3. Scale ECS Service
    • Click on the Scale ECS Service workflow.
    • Choose an ECS service that currently has running tasks.
    • Enter a different desired count (for example, if it has 2 tasks, try 3 or 1).
    • Click 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 workflow.
    • 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 Execute.
  5. Restart ECS Service
    • Click on the Restart ECS Service workflow.
    • Choose an ECS service to restart.
    • Click Execute.
  6. Rollback Deployment
    • Click on the Rollback Deployment workflow.
    • Choose an ECS service that has been updated at least once.
    • Click Execute.
    • Ask a user with the Admin role to approve the request.
    • Monitor the rollback in the workflow run and in GitHub Actions.
  7. Delete ECS Service
    • Click on the Delete ECS Service workflow.
    • Choose a test service that can be safely deleted.
    • Click Execute.
    • Ask a user with the Admin role to approve the request.
    • Monitor the deletion in the workflow run and in GitHub Actions.

Visualize metrics​

With your data and workflows 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 workflows (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 workflows (click to expand)
  1. Click + Widget and select Workflow card (learn more).
  2. Under Workflows, choose the Scale ECS Service, Restart ECS Service, Update Task Definition, Service Health Check, Rollback Deployment, and Delete ECS Service workflows we created in this guide.
  3. Title: ECS service management (add the AWS icon).
  4. 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:

  • You have a Port account and have completed the onboarding process.
  • Port's AWS integration is installed in your account.
  • Port's GitHub integration is installed for running workflows.
  • 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.

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 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 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 installation ID. Go to the Connectors page, find your GitHub 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 installation ID. Go to the Connectors page, find your GitHub 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 installation ID. Go to the Connectors page, find your GitHub 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:

  • You have a Port account and have completed the onboarding process.
  • Port's AWS integration is installed in your account.
  • Port's GitHub integration is installed for running workflows.
  • 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 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 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 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 installation ID. Go to the Connectors page, find your GitHub 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 installation ID. Go to the Connectors page, find your GitHub 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:

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

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

  • You have a GitHub integration for running workflows:

  • GitHub is installed.

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 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 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 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 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 installation ID. Go to the Connectors page, find your GitHub 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 installation ID. Go to the Connectors page, find your GitHub 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 installation ID. Go to the Connectors page, find your GitHub 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 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 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 installation ID. Go to the Connectors page, find your GitHub 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 installation ID. Go to the Connectors page, find your GitHub 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 installation ID. Go to the Connectors page, find your GitHub 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​