View a markdown version of this page

Connecting Agent Spaces in a constellation - AWS Ops Agent (formerly DevOps Agent)

Connecting Agent Spaces in a constellation

This topic explains how to connect two Agent Spaces in a constellation. Before you start, read Agent Space Constellations to choose the relationship type and to understand what a connection grants.

A connection has two sides. The owner of each Agent Space creates their own side, and the connection becomes Active after both sides exist.

Prerequisites

Before you connect Agent Spaces, make sure that you have the following:

  • The Agent Spaces that you want to connect. They can be in the same AWS account or in different accounts. They can be in the same AWS Region or in different AWS Regions within the aws partition. Agent Space Constellations isn't available in AWS GovCloud (US).

  • The Amazon Resource Name (ARN) of the other Agent Space. If you don't own the other Agent Space, ask its owner for the ARN. To copy the ARN, the owner opens the AWS Ops Agent console, opens their Agent Space, chooses Actions, and then chooses Copy ARN.

  • An agreement with the owner of the other Agent Space on the relationship type and on the role of each side.

  • AWS Identity and Access Management (IAM) permissions to create or pass an IAM role in your account.

Step 1: Set up the constellation role

In this step, you set up the role that your Agent Space uses to call the other Agent Space. The constellation role is the IAM role that AWS Ops Agent assumes when your Agent Space calls another Agent Space. With a dedicated role, the cross-Agent Space permissions stay separate from your other permissions.

Each Agent Space in a constellation needs its own constellation role. You need a role on both sides of every connection, including the dependency side.

You can have the console create the role when you create the connection, or you can create the role yourself.

Option A: Have the console create the role

Choose this option if you don't manage IAM roles with infrastructure as code. In Step 3: Create your side of the connection, on the Register role page, choose Auto-create a new Ops Agent role. You get a role named DevOpsAgentRole-Constellation-suffix, where suffix is a value that the console adds to the name. The role has the AWS managed policy AIDevOpsConstellationAccessPolicy attached. If either Agent Space uses a customer managed key, you must also add the AWS KMS permissions in Step 2 to this role.

Option B: Create the role yourself

Choose this option if you manage IAM roles with infrastructure as code. Use a dedicated role for each Agent Space, and don't reuse the monitoring role of the Agent Space. A dedicated role makes AWS CloudTrail events easier to attribute.

The role needs a trust policy and a permissions policy:

  • Trust policy – With this policy, aidevops.amazonaws.com can call sts:AssumeRole and sts:TagSession, scoped to your Agent Space.

  • Permissions policy – The AWS managed policy AIDevOpsConstellationAccessPolicy contains the operations in the constellation permission set. Use the same policy in every Agent Space of every connection. For each call, AWS Ops Agent applies a session policy that limits the role to the operations that the relationship allows. For example, a dependency's session can only call aidevops:GetAgentSpace on its consumer.

The trust policy uses the following placeholder values. Replace them with your own values:

  • 123456789012 – Your AWS account ID. It appears in both aws:SourceAccount and aws:SourceArn.

  • us-east-1 – The AWS Region of your Agent Space.

  • agent-space-id – The ID of your Agent Space.

With these values replaced, the aws:SourceArn value is the ARN of your Agent Space.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "aidevops.amazonaws.com" }, "Action": [ "sts:AssumeRole", "sts:TagSession" ], "Condition": { "StringEquals": { "aws:SourceAccount": "123456789012", "aws:SourceArn": "arn:aws:aidevops:us-east-1:123456789012:agentspace/agent-space-id" } } } ] }

To create the role

  1. Open the AWS Identity and Access Management (IAM) console at https://console.aws.amazon.com/iam/.

  2. Create an IAM role with the trust policy, using your values for the placeholders.

  3. Attach the AWS managed policy AIDevOpsConstellationAccessPolicy to the role.

The role appears in the IAM console with the trust policy and the managed policy. If you can't create the role, check that you have permission to create IAM roles in your account.

In Step 3: Create your side of the connection, on the Register role page, choose Assign an existing role, and then choose this role.

Step 2: Add permissions for Agent Spaces encrypted with a customer managed key

In this step, you give the calling Agent Space permission to decrypt the data of an Agent Space that a customer managed key encrypts. Skip this step if neither Agent Space uses a customer managed key in AWS Key Management Service (AWS KMS).

If an Agent Space's data is encrypted with a customer managed AWS KMS key, the other Agent Space needs permission to decrypt that data. The AWS managed policy AIDevOpsConstellationAccessPolicy doesn't grant any AWS KMS permissions, and the console doesn't add them to the roles that it creates. In this step, you add two permissions yourself: an inline policy on the constellation role of the calling Agent Space, and a statement in the key policy of the encrypted Agent Space. Without both, calls into the encrypted Agent Space fail even when the connection is Active. For more information about customer managed keys, see Encryption at rest for AWS Ops Agent.

This step uses the following terms:

  • The calling Agent Space opens investigations in, or reads from, the other Agent Space.

  • The encrypted Agent Space has its data encrypted with a customer managed key.

The relationship determines which Agent Space is the calling Agent Space, as shown in the following table.

Relationship Encrypted Agent Space Calling Agent Space
Lead and encrypted member Member Lead
Member and encrypted lead Lead Member, so that the member can escalate
Consumer and encrypted dependency Dependency Consumer
Both Agent Spaces encrypted Both Both. Each key policy allows the other Agent Space's account.

You add an inline policy to the constellation role of the calling Agent Space. Add this policy even if the console creates the role, because the managed policy AIDevOpsConstellationAccessPolicy doesn't include kms:Decrypt. If you chose Option A, the role doesn't exist yet. Add the key policy statement now, and add the inline policy to the role after Step 3 creates it. The kms:ViaService condition limits the permission to calls that AWS Ops Agent makes. The encryption context condition limits it to data that belongs to an Agent Space.

Add the following inline policy to the constellation role of the calling Agent Space.

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowConstellationPeerCmkDecryptViaDevOpsAgent", "Effect": "Allow", "Action": "kms:Decrypt", "Resource": "arn:aws:kms:*:*:key/*", "Condition": { "StringLike": { "kms:ViaService": "aidevops.*.amazonaws.com", "kms:EncryptionContext:aws-crypto-ec:aws:aidevops:arn": "arn:aws:aidevops:*:*:agentspace/*" } } } ] }

Add the following statement to the key policy of the encrypted Agent Space. The statement uses two placeholder values. Replace 123456789012 with the account ID of the calling Agent Space, and replace us-east-1 with the AWS Region of the encrypted Agent Space.

{ "Sid": "AllowConstellationPeerViaDevOpsAgent", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012:root" }, "Action": "kms:Decrypt", "Resource": "*", "Condition": { "StringEquals": { "kms:ViaService": "aidevops.us-east-1.amazonaws.com" } } }

To add the permissions

  1. In the account of the calling Agent Space, open the IAM console at https://console.aws.amazon.com/iam/.

  2. Add the inline policy to the constellation role of the calling Agent Space.

  3. In the account of the encrypted Agent Space, open the AWS KMS console at https://console.aws.amazon.com/kms.

  4. Add the key policy statement, with your values for the placeholders, to the key policy of the customer managed key of the encrypted Agent Space.

After you add both permissions, AWS Ops Agent can decrypt the encrypted Agent Space's data when the calling Agent Space calls it.

Step 3: Create your side of the connection

In this step, you create the connection from your Agent Space to the other Agent Space. Before you start, complete Step 1. If either Agent Space uses a customer managed key, also complete Step 2. If the console creates the role, add the Step 2 inline policy to that role after you create the connection.

The connection wizard has three pages: Specify connection, Register role, and Review and create.

To open the connection wizard

  1. Open the AWS Ops Agent console.

  2. Choose Agent Spaces.

  3. Select the Agent Space that you want to connect.

  4. Choose the Constellations tab.

  5. In the upper-right corner of the Agent Space Constellations panel, choose Create connection.

On the Specify connection page, choose the role that your Agent Space plays toward the other Agent Space. For what each role does, see Relationship types.

  • Connect as lead – The other Agent Space is your member.

  • Connect as member – The other Agent Space is your lead. This option isn't available if your Agent Space already has a lead.

  • Connect as consumer – The other Agent Space is your dependency.

  • Connect as dependency – The other Agent Space is your consumer.

To specify the connection

  1. For Target agent space ARN, enter the ARN of the other Agent Space.

  2. Under Connection role, select the role that your Agent Space plays toward the other Agent Space.

  3. Choose Next.

On the Register role page, you choose the constellation role for your Agent Space:

The Register role page has an IAM role section. Under Choose a role option, it lists Auto-create a new Ops Agent role and Assign an existing role. When you choose Auto-create a new Ops Agent role, a message shows the name of the role that the console creates. The page also has Cancel, Previous, and Next buttons.

To register the role and create the connection

  1. On the Register role page, select Auto-create a new Ops Agent role or Assign an existing role.

  2. If you selected Assign an existing role, choose the role that you created in Option B: Create the role yourself.

  3. Choose Next.

  4. On the Review and create page, review the details.

  5. Choose Create connection.

The connection appears in the Connections table with the status Pending. It stays Pending until the owner of the other Agent Space creates their side. If you can't create the connection, check that the ARN is correct and that you have the IAM permissions listed in Prerequisites.

Step 4: Create the other side of the connection

In this step, the owner of the other Agent Space creates their side of the connection. Both sides must create the connection before it becomes Active.

The other side must choose the role that complements yours. The following table shows the complementary role for each choice.

Your choice The other side's choice
Connect as lead Connect as member
Connect as member Connect as lead
Connect as consumer Connect as dependency
Connect as dependency Connect as consumer

After you agree on the roles, do the following.

To have the other side create the connection

  1. Open your Agent Space, choose Actions, and then choose Copy ARN.

  2. Send the ARN of your Agent Space to the owner of the other Agent Space.

  3. Ask the owner to complete Step 1: Set up the constellation role, Step 2 if either Agent Space uses a customer managed key, and Step 3: Create your side of the connection in their Agent Space. For Target agent space ARN, they enter the ARN of your Agent Space.

  4. Confirm with the owner that they selected the complementary role from the preceding table.

Step 5: Verify the connection

In this step, you confirm that the connection is active and points in the right direction.

After both owners create their sides, the status changes to Active on both sides. The status can take several minutes to change. The Connections table doesn't refresh on its own. To see the current status, choose the refresh button above the table.

The Role of connected space column shows the role of the other Agent Space, not your own. For example, in a member Agent Space, the connection to its lead shows Lead.

Before you add more connections, verify the following:

  1. The lead lists each of its members, and each member lists its lead.

  2. Each consumer lists its dependencies, and each dependency lists its consumers.

  3. The direction of each connection matches the way that your teams handle incidents.

Next steps