Skip to main content

Examples

This page contains the base examples for mapping AWS resources to Port.

This base example thrives to provide a simpler and more abstract way to map AWS resources to Port.

The simplification is achieved by using the generic cloudResource blueprint, which can be used to map any AWS resource to Port.

Mapping AWS Accounts

In the following example you will ingest your AWS Accounts to Port, you may use the following Port blueprint definitions and integration configuration:

Account Blueprint
{
"identifier": "awsAccount",
"title": "AWS account",
"icon": "AWS",
"schema": {
"properties": {
"arn": {
"type": "string",
"title": "Arn"
},
"email": {
"type": "string",
"title": "Email"
},
"status": {
"type": "array",
"title": "Status",
"default": [
"ACTIVE"
],
"items": {
"enum": [
"ACTIVE",
"SUSPENDED",
"PENDING_CLOSURE"
],
"enumColors": {
"ACTIVE": "green",
"SUSPENDED": "red",
"PENDING_CLOSURE": "yellow"
},
"type": "string"
}
},
"joined_method": {
"type": "string",
"title": "Joined Method",
"enum": [
"INVITED",
"CREATED"
],
"enumColors": {
"INVITED": "lightGray",
"CREATED": "lightGray"
}
},
"joined_timestamp": {
"type": "string",
"title": "Joined Timestamp",
"format": "date-time"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {}
},
Mapping configuration for AWS Accounts
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

Here are the API references we used to create those blueprints and app config:

Mapping Cloud Resources

In the following example you will ingest your AWS Resources to Port, you may use the following Port blueprint definitions and integration configuration:

Relate resources and Accounts

The Resources below have a relation to the Account, so the creation of the Account is required.

Cloud Resource Blueprint
{
"identifier": "cloudResource",
"title": "AWS Cloud Resource",
"icon": "AWS",
"schema": {
"properties": {
"kind": {
"title": "Kind",
"type": "string"
},
"tags": {
"items": {
"type": "object"
},
"type": "array",
"title": "Tags"
},
"arn": {
"type": "string",
"title": "ARN"
},
"link": {
"type": "string",
"title": "Link",
"icon": "AWS",
"format": "url"
},
"region": {
"type": "string",
"title": "Region"
}
},
"required": []
},
"mirrorProperties": {},
"calculationProperties": {},
"aggregationProperties": {},
"relations": {
"account": {
"title": "Account",
"target": "awsAccount",
"required": true,
"many": false
}
}
}
Mapping configuration for cloud resources
resources:
- kind: AWS::S3::Bucket
selector:
query: 'true'
useGetResourceAPI: 'true'
port:
entity:
mappings:
identifier: .Identifier
title: .Identifier
blueprint: '"cloudResource"'
properties:
kind: .__Kind
region: .__Region
tags: .Properties.Tags
arn: .Properties.Arn
link: >-
.Properties | select(.Arn != null) |
"https://console.aws.amazon.com/go/view?arn=" + .Arn
relations:
account: .__AccountId
- kind: AWS::EC2::Instance
selector:
query: 'true'
port:
entity:
mappings:
identifier: .Identifier
title: .Identifier
blueprint: '"cloudResource"'
properties:
kind: .__Kind
region: .__Region
tags: .Properties.Tags
arn: >-
'arn:aws:ec2:' +
.__Region + ':' + .__AccountId + ':instance/' + .Properties.InstanceId
link: >-
'https://console.aws.amazon.com/ec2/home?region=' +
.__Region + InstanceDetails:instanceId=' + Properties.InstanceId
relations:
account: .__AccountId
- kind: AWS::ECS::Cluster
selector:
query: 'true'
port:
entity:
mappings:
identifier: .Identifier
title: .Identifier
blueprint: '"cloudResource"'
properties:
kind: .__Kind
region: .__Region
tags: .Properties.Tags
arn: .Properties.Arn
link: >-
.Properties | select(.Arn != null) |
"https://console.aws.amazon.com/go/view?arn=" + .Arn
relations:
account: .__AccountId

Mapping Extra Resources

The resources in this page are only a few of the resources that the AWS Integration supports.

If the resources you want to ingest into Port do not appear in these examples, you can head to the Mapping Extra Resources page to learn about all of the kinds of AWS resources that are supported by the AWS integration and how to map them into Port.