Associating an environment, account connection, and IAM role with a workflow action - Amazon CodeCatalyst

Associating an environment, account connection, and IAM role with a workflow action

When you associate an environment, account connection, and IAM role with a supported workflow action, the IAM role becomes available for use by the action. In addition to gaining access to an IAM role, the action may also have its deployment information imported into the Environments page. For more information, see Which actions support environments?.

Use the following instructions to associate an environment, account connection, and IAM role with an action.

Step 1: Associate the environment, account connection, and role to a workflow action

Use the following procedure to associate an environment, account connection, and role with a workflow action.

Visual
To associate an environment, account connection, and role with a workflow action using the visual editor
  1. Open the CodeCatalyst console at https://codecatalyst.aws/.

  2. Choose your project.

  3. In the navigation pane, choose CI/CD, and then choose Workflows.

  4. Choose the name of your workflow. You can filter by the source repository or branch name where the workflow is defined, or filter by workflow name.

  5. Choose Edit.

  6. Choose Visual.

  7. In the workflow diagram, choose an action that is supported with environments. For more information, see Which actions support environments?.

  8. Choose the Configuration tab, and specify information into the fields, as follows.

    Environment

    Specify the CodeCatalyst environment to use with the action.

    For more information about environments, see Working with environments and Creating an environment.

    Account connection or Connection - optional (whichever is available)

    Specify the account connection to associate with the action. You can specify a maximum of one account connection under Environment.

    For more information about account connections, see Administering AWS accounts for a space. For information about how to associate an account connection with your environment, see Creating an environment.

    Role

    Specify the name of the IAM role that this action uses in order to access and operate in AWS services such as Amazon S3 and Amazon ECR. Make sure this role is added to your account connection. To add an IAM role to an account connection, see Adding IAM roles to account connections.

    Note

    You may be able to specify the name of the CodeCatalystWorkflowDevelopmentRole-spaceName role here, provided it has sufficient permissions. For more information about this role, see Creating the CodeCatalystWorkflowDevelopmentRole-spaceName role for your account and space. Understand that the CodeCatalystWorkflowDevelopmentRole-spaceName role has very broad permissions which may pose a security risk. We recommend that you only use this role in tutorials and scenarios where security is less of a concern.

    If you don't see the role in the list, it's because you have not associated it to the account connection. For more information, see Adding IAM roles to account connections.

  9. (Optional) Choose Validate to validate the workflow's YAML code before committing.

  10. Choose Commit, enter a commit message, and choose Commit again.

YAML
To associate an environment, account connection, and role with a workflow action using the YAML editor
  1. Open the CodeCatalyst console at https://codecatalyst.aws/.

  2. Choose your project.

  3. In the navigation pane, choose CI/CD, and then choose Workflows.

  4. Choose the name of your workflow. You can filter by the source repository or branch name where the workflow is defined, or filter by workflow name.

  5. Choose Edit.

  6. Choose YAML.

  7. In the workflow action that you want to associate with an environment, add code similar to the following:

    action-name Environment: Name: environment-name Connections: - Name: account-connection-name Role: iam-role-name

    For more information, see the Workflow definition reference for your action.

  8. (Optional) Choose Validate to validate the workflow's YAML code before committing.

  9. Choose Commit, enter a commit message, and choose Commit again.

Step 2: Populate the environment

After associating an environment, account connection, and role to workflow action, you can populate the Environments page with deployment information. Use the following instructions to populate the Environments page.

Note

The Environments page is supported by only a subset of workflow actions. For more information, see Which actions support environments?.

To populate the environment
  1. If a workflow run did not start automatically when you committed your changes in Step 1: Associate the environment, account connection, and role to a workflow action, manually start a run as follows:

    1. In the navigation pane, choose CI/CD, and then choose Workflows.

    2. Choose the name of the workflow where you want to start a run. You can filter by the source repository or branch name where the workflow is defined, or filter by workflow name.

    3. Choose Run.

    The workflow run starts a new deployment, which causes CodeCatalyst to add your application resource information under Environments.

  2. Verify that your application resources appear under your environment:

    1. In the navigation pane, choose CI/CD, and then choose Environments.

    2. Choose your environment (for example, Production).

    3. Choose the Deployment activity tab, and verify that a deployment appears with a Status of SUCCEEDED. This indicates that a workflow run successfully deployed your application resources.

    4. Choose the Deployment targets tab, and verify that your application resources appear.