# AWS (Instance Profile)

## Overview

This guide explains what capabilities StrongDM can provide for managing command line access to the AWS cloud. It also provides setup and configuration instructions to add AWS as a resource in StrongDM and begin using StrongDM to control access for users who wish to access your cloud via the AWS CLI. StrongDM users are authenticated with AWS and granted the level of access that you configure on the AWS side.

In addition to access control and auditing, AWS access through StrongDM can be a part of a variety of use cases and access control methodologies:

* **Least Privilege**: For AWS clouds, least privilege can be accomplished by setting up multiple instances of the console as StrongDM resources. Each resource would connect to AWS using a different set of credentials with different permissions granted to it.
* **Just-in-Time Access**: StrongDM users are able to use any access workflows you set up to request access to AWS, allowing you the choice between granting Just-in-Time (JIT) access with requests, or providing standing access to particular users or roles within your StrongDM organization. For more details, see the [Access Workflows](https://docs.strongdm.com/admin/access/access-workflows) section.

{% hint style="info" %}
To avoid confusion during access requests, if there are multiple AWS (Instance Profile) cloud resources in StrongDM, it may be useful to name them in such a way that indicates the level of access, so that users know the name of the resource to request.
{% endhint %}

* **Context-Based Policy**: StrongDM policies that restrict or enable users' ability to connect to AWS cloud resources based on their context can be used to limit availability of your AWS CLI to users in particular geographic locations or with good device trust scores. Policies can also be used to provide an MFA challenge prior to connection, and help solve for many more use cases. For more details, see the [Policies](https://docs.strongdm.com/admin/access/policies) section.

{% hint style="info" %}
This resource type is nearly the same as the AWS cloud resource type, except that it does not support static keys for authentication. The authentication modes supported are environment-loaded credentials. Please see [Configure AWS](https://docs.strongdm.com/admin/resources/clouds/aws) if you wish to use static keys to manage access to your AWS cloud environment via StrongDM.

This is the method by which to set up your AWS cloud and manage it with the AWS CLI. If you intend to connect to a specific AWS-hosted resource, such as Athena or an EC2 instance, those resources need to be set up separately in the appropriate areas of the Admin UI.
{% endhint %}

## Limitations

* Note that `sdm aws cli ssm start-session` is not currently supported when using the AWS CLI via StrongDM due to an AWS technical limitation. If you wish to use `ssm` sessions, you can set up the [AWS Console](https://docs.strongdm.com/admin/resources/clouds/aws-console) resource type and use the web interface to initiate a session with `ssm`.
* The AWS driver does nothing to limit privilege escalation. It is the responsibility of the resource creator not to provide credentials that can be used to create more credentials.

## AWS Cloud Properties

The AWS (Instance Profile) resource type supports environment-loaded credentials, which can be one of the following:

* AWS access keys in standard AWS [environment variables](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html) on the node(s) (gateways or relays)
* AWS access keys configured as a standard AWS profile on the node(s)
* An EC2 instance profile or [ECS profile](https://docs.aws.amazon.com/sdkref/latest/guide/feature-container-credentials.html) linked to the host or container running the node(s)

## Prerequisites

* In StrongDM, you must have the Admin [permission level](https://docs.strongdm.com/admin/access/permission-level).
* To manage access to your AWS cloud environment via StrongDM, you must have an AWS key pair (Access Key ID and AWS Secret Access Key) prepared. The scope of this key determines which AWS CLI commands your users can execute through StrongDM, so consider that when generating the key. Once you have your AWS key, you can set up a cloud resource in the StrongDM Admin UI.
* Your nodes must be running at least version 31.10 to support usage of the AWS CLI to administer your AWS cloud.

## Resource Configuration in StrongDM

This section provides instructions for adding the resource in either the StrongDM Admin UI, CLI, Terraform provider, or SDKs.

{% tabs %}
{% tab title="Admin UI" %}
**Set up and Manage With the Admin UI**

If using the Admin UI to add the resource to StrongDM, use the following steps.

1. Log in to the Admin UI and go to **Resources** > **Managed Resources**.
2. Click **Add Resource**. Note that there are two types and they have different properties.
3. For **Resource Type**, set **AWS (Instance Profile)**.
4. Set all other required [resource properties](#resource-properties).
5. Click **create** to save the resource.
6. Click the resource name to view status, diagnostic information, and setting details. After the server is created, the Admin UI displays that resource as unhealthy until the health checks run successfully. When the resource is ready, the **Health** icon indicates a positive, green status.
   {% endtab %}

{% tab title="CLI" %}
**Set up and Manage With the CLI**

This section provides general steps on how to configure and manage the resource using the StrongDM CLI. For more information and examples, please see the [CLI Reference](https://docs.strongdm.com/references/cli) documentation.

1. In your terminal or Command Prompt, log in to StrongDM:

   ```sh
   sdm login
   ```
2. Run `sdm admin clouds add awsinstanceprofile --help` to view the help text for the command, which shows you how to use the command and what options (properties) are available. Note which [properties](#resource-properties) are required and collect the values for them.\\

   ```
   NAME:
      sdm admin clouds add awsinstanceprofile - create AWS (Instance Profile) cloud

   USAGE:
      sdm admin clouds add awsinstanceprofile [command options] <name>

   OPTIONS:
      --bind-interface value                     IP address on which to listen for connections to this resource on clients. Specify "default", "loopback", or "vnm" to automatically allocate an available address from the corresponding IP range configured in the organization. (default: "default")
      --egress-filter value                      apply filter to select egress nodes e.g. 'field:name tag:key=value ...'
      --enable-environment-variables             Prefer environment variables to authenticate connection even if EC2 roles are configured.
      --port-override value                      Port on which to listen for connections to this resource on clients. Specify "-1" to automatically allocate an available port. (default: -1)
      --proxy-cluster-id value                   proxy cluster id
      --region value                             The AWS region to connect to. (required)
      --role-arn value                           The role to assume after logging in. (secret)
      --role-external-id value                   (secret)
      --secret-store-id value                    secret store id
      --subdomain value, --bind-subdomain value  DNS subdomain through which this resource may be accessed on clients (e.g. "app-prod" allows the resource to be accessed as "app-prod.<your-org-name>.<sdm-proxy-domain>"). Only applicable to HTTP-based resources or resources using virtual networking mode.
      --tags value                               tags e.g. 'key=value,...'
      --template, -t                             display a JSON template
      --timeout value                            set time limit for command
   ```
3. Then run `sdm admin clouds add awsConsole|awsinstanceprofile <RESOURCE_NAME>` and set all required properties with their values. For example:

   ```
   sdm admin clouds add awsinstanceprofile "aws-instance-profile-prod"
     --region "us-west-2"
     --role-arn "arn:aws:iam::123456789012:role/StrongDMAccessRole"
     --role-external-id "acme-instanceprofile-2025"
     --bind-interface "default"
     --port-override -1
     --subdomain "aws-instance-profile-prod01"
     --egress-filter 'field:name tag:env=prod tag:region=us-west'
     --proxy-cluster-id "plc_0123456789abcdef"
     --secret-store-id "ss_abcdef0123456789"
     --enable-environment-variables
     --tags "env=prod,cloud=aws,auth=instance-profile,team=infra"
     --timeout 30
   ```
4. Check that the resource has been added. The output of the following command should show the resource's name:

   ```sh
   sdm admin clouds list
   ```

{% endtab %}

{% tab title="Terraform" %}
**Set up and Manage With Terraform**

This section provides an example of how to configure and manage the resource using the Terraform provider. For more information and examples, please see the [Terraform provider](https://github.com/strongdm/terraform-provider-sdm) documentation.

```hcl
# Install StrongDM provider
terraform {
  required_providers {
    sdm = {
      source  = "strongdm/sdm"
      version = "16.5.0"
    }
  }
}

# Configure StrongDM provider
provider "sdm" {
  # Add API access key and secret key from the Admin UI
  api_access_key = "njjSn...5hM"
  api_secret_key = "ziG...="
}

# Create AWS (Instance Profile)
resource "sdm_resource" "aws_instance_profile_prod" {
  aws_instance_profile {
    # Required
    name   = "aws-instance-profile-prod"                 # <name>
    region = "us-west-2"                                 # --region

    # Optional role to assume after using instance profile creds
    role_arn         = "arn:aws:iam::123456789012:role/StrongDMAccessRole"  # --role-arn (optional)
    role_external_id = "ext-id-aws-ip-2025"                                  # --role-external-id

    # Common networking options
    bind_interface = "default"                             # --bind-interface ("default" | "loopback" | "vnm")
    port_override  = -1                                    # --port-override (-1 = auto-allocate)
    egress_filter  = "field:name tag:env=prod tag:region=us-west"  # --egress-filter
    subdomain      = "aws-instance-profile-prod01"         # --subdomain / --bind-subdomain (for VN access)

    # Optional integrations
    proxy_cluster_id = "plc_0123456789abcdef"              # --proxy-cluster-id
    secret_store_id  = "ss_abcdef0123456789"               # --secret-store-id

    # Prefer environment variables even if EC2 role metadata is available
    enable_environment_variables = true                    # --enable-environment-variables

    # Tags
    tags = {                                               # --tags
      env   = "prod"
      cloud = "aws"
      auth  = "instance-profile"
      team  = "infra"
    }
  }
}
```

{% endtab %}

{% tab title="SDKs" %}
**Set up and Manage With SDKs**

In addition to the Admin UI, CLI, and Terraform, you may configure and manage your resource with any of the following SDK options: Go, Java, Python, and Ruby. Please see the following references for more information and examples.

| Go            | ​[pkg.go.dev](https://pkg.go.dev/github.com/strongdm/strongdm-sdk-go/v16)​ | ​[strongdm-sdk-go](https://github.com/strongdm/strongdm-sdk-go)​         | ​[Go SDK Examples](https://github.com/strongdm/strongdm-sdk-go-examples)​         |
| ------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------- |
| Java          | ​[javadoc](https://strongdm.github.io/strongdm-sdk-java-docs/)​            | ​[strongdm-sdk-java](https://github.com/strongdm/strongdm-sdk-java)​     | ​[Java SDK Examples](https://github.com/strongdm/strongdm-sdk-java-examples)​     |
| Python        | ​[pdocs](https://strongdm.github.io/strongdm-sdk-python-docs/)​            | ​[strongdm-sdk-python](https://github.com/strongdm/strongdm-sdk-python)​ | ​[Python SDK Examples](https://github.com/strongdm/strongdm-sdk-python-examples)​ |
| Ruby          | ​[RubyDoc](https://www.rubydoc.info/gems/strongdm)​                        | ​[strongdm-sdk-ruby](https://github.com/strongdm/strongdm-sdk-ruby)​     | ​[Ruby SDK Examples](https://github.com/strongdm/strongdm-sdk-ruby-examples)​     |
| {% endtab %}  |                                                                            |                                                                          |                                                                                   |
| {% endtabs %} |                                                                            |                                                                          |                                                                                   |

## Resource properties

The **AWS (Instance Profile)** cloud type has the following properties.

<table><thead><tr><th width="199.7528076171875">Property</th><th width="129.617919921875">Requirement</th><th>Description</th></tr></thead><tbody><tr><td><strong>Display Name</strong></td><td>Required</td><td>Meaningful name to display the resource throughout StrongDM; exclude special characters like quotes (") or angle brackets (&#x3C; or >)</td></tr><tr><td><strong>Cloud Type</strong></td><td>Required</td><td><strong>AWS (Instance Profile)</strong></td></tr><tr><td><strong>Proxy Cluster</strong></td><td>Required</td><td>Defaults to "None (use gateways)"; if using <a href="../../networking/proxy-clusters">proxy clusters</a>, select the appropriate cluster to proxy traffic to this resource</td></tr><tr><td><strong>Connectivity Mode</strong></td><td>Required</td><td>Select either <strong>Virtual Networking Mode</strong>, which lets users connect to the resource with a software-defined, IP-based network; or <strong>Loopback Mode</strong>, which allows users to connect to the resource using the local loopback adapter in their operating system; this field is shown if <a href="../../clients/client-networking/virtual-networking-mode">Virtual Networking Mode</a> enabled for your organization</td></tr><tr><td><strong>IP Address</strong></td><td>Optional</td><td>If <strong>Virtual Networking Mode</strong> is the selected connectivity mode, an IP address value in the configured Virtual Networking Mode subnet in the organization network settings; if <strong>Loopback Mode</strong> is the selected connectivity mode, an IP address value in the configured Loopback IP range in the organization network settings (by default, <code>127.0.0.1</code>); if not specified, an available IP address in the configured IP address space for the selected connectivity mode will be automatically assigned; this field is shown if <a href="../../clients/client-networking/virtual-networking-mode">Virtual Networking Mode</a> and/or <a href="../../clients/client-networking/loopback-ip-ranges">multi-loopback mode</a> is enabled for your organization</td></tr><tr><td><strong>Port Override</strong></td><td>Optional</td><td>If <strong>Virtual Networking Mode</strong> is the selected connectivity mode, a port value between 1 and 65535 that is not already in use by another resource with the same IP address; if <strong>Loopback Mode</strong> is the selected connectivity mode, a port value between 1024 to 64999 that is not already in use by another resource with the same IP address; when left empty with Virtual Networking Mode, the system assigns the default port to this resource; when left empty for Loopback Mode, an available port that is not already in use by another resource is assigned; preferred port also can be modified later from the <a href="../port-overrides">Port Overrides settings</a></td></tr><tr><td><strong>DNS</strong></td><td>Optional</td><td>If Virtual Networking Mode is the selected connectivity mode, a unique hostname alias for this resource; when set, causes the desktop app to display this resource's human-readable DNS name (for example, <code>k8s.my-organization-name</code>) instead of the bind address that includes IP address and port (for example, <code>100.64.100.100:5432</code>)</td></tr><tr><td><strong>Secret Store</strong></td><td>Optional</td><td>Credential store location; defaults to none (credentials are stored in StrongDM resource configuration)</td></tr><tr><td><strong>Enable Environment Variables</strong></td><td>Optional</td><td>When selected, lets you use environment variables to authenticate connection even if EC2 roles are configured</td></tr><tr><td><strong>Assume Role ARN</strong></td><td>Optional</td><td>Amazon Resource Name (ARN) role to assume after login (for example, <code>arn:aws:iam::000000000000:role/RoleName</code>)</td></tr><tr><td><strong>Region</strong></td><td>Required</td><td>AWS region to connect to (for example, <code>us-west-2</code>)</td></tr><tr><td><strong>Assume Role External ID</strong></td><td>Optional</td><td>External ID role to assume after login (for example <code>12345</code>)</td></tr><tr><td><strong>Resource Tags</strong></td><td>Optional</td><td>Enter <a data-mention href="https://app.gitbook.com/s/4XOJmXFslCMVCzIG2rKp/cli/tags">Tags</a> consisting of key-value pairs <code>&#x3C;KEY>=&#x3C;VALUE></code> (for example, <code>env=dev</code>)</td></tr></tbody></table>

### **Secret Store options**

By default, resource credentials are stored with StrongDM in your resource configuration. However, these credentials also can be saved in a secret store.

Non-StrongDM options appear in the **Secret Store** dropdown if they are created under **Settings** > **Secrets Management**. When you select another Secret Store type, its unique properties display. For more details, see [Configure Secret Store Integrations](https://docs.strongdm.com/admin/access/secret-stores).

## Logs

For logs of access to an AWS cloud resource, in the **Cloud logs** section of the Admin UI (**Logs** > **Cloud**), you can find all of the activities of users connected through StrongDM. Note that StrongDM makes an attempt to drop the Authorization header of logs for display in the Admin UI. Note that any secrets displayed in the cloud logs are placeholder values. No actual keys or secrets are ever exposed in plaintext in the Admin UI.

For AWS Web Console resources, access is logged, but further activities on the Web Console are not logged by StrongDM. Consult your AWS logs for further information on user activity.

## CLI Usage

When the resource is created and configured, you are ready for users to connect to the resource. In order for your organization's users to access the AWS cloud resource via StrongDM, users need to install the following:

* The StrongDM Desktop application
* The latest version of the StrongDM CLI. If the CLI is already installed, you can run `sdm update` in the CLI to update it. Alternatively, if any updates are available, you can open the GUI and click the **Upgrade** button.
* The AWS CLI. We support both v1 and v2 but encourage the use of v2.

After installation, users must set up or update the AWS CLI configuration file to include a region, as explained in the [AWS documentation](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html). Once that is done, exit and restart the StrongDM desktop app, and then select the AWS cloud resource to connect to.

Click to connect to the resource in the desktop app, or run `sdm connect <RESOURCE>` in the CLI. Once connected, users can use `aws` through StrongDM at their terminal, with the base syntax of `sdm aws` instead of the usual `aws`.

You can use `sdm aws --help` to view example usage and command options:

```shell
NAME:
   sdm aws - aws commands

USAGE:
   sdm aws command [command options] [arguments...]

COMMANDS:
   cli        Execute an AWS CLI Command.
   env        Print environment variables required to access an AWS resource.
   run        Execute an external command with environment variables configured for AWS.
   terraform  Execute terraform commands with a SDM AWS proxy.

OPTIONS:
   --name value     The name of the AWS resource to access. By default if there is only one connected AWS resource, that resource is used. [$SDM_AWS_NAME]
   --help, -h  show help
```

### aws cli

The `aws cli` command is followed by an AWS CLI command that you wish to run against your connected AWS resource. For more information about gcloud CLI commands, see the [AWS CLI documentation](https://docs.aws.amazon.com/cli/latest/).

### aws env

The `aws env` command outputs the environment variables that are required in order to access an AWS resource. This output is a similar format of the output of the standard `env` command, but only contains the relevant environment variables for connecting to AWS.

### aws run

The `aws run` command is followed by a command that you wish to run against the connected resource, which is sent along with the necessary environment variables. An example of a use for `aws run` would be if you have a pre-existing script for managing AWS resources that uses `aws` commands. Shell scripts using the non-StrongDM `aws` CLI can be run with `sdm aws run` (for example, `sdm aws run shell-script-using-aws-cli.sh`), which has the same effect as changing the shell script to use `sdm aws cli` in place of `aws`.

### --name

If your organization has multiple AWS cloud resources, and you are connected to more than one at once, you may specify a `--name` value in commands in order to specify which you intend to execute the command on. For example, `sdm aws --name <RESOURCE_NAME> cli`. The flag must come before the `cli` portion of the command in order to preserve the ability to use the command as normal with a single AWS cloud resource connected.

## Error Cases

Should you attempt to use a cloud resource when you are not connected to it, StrongDM's CLI commands warn you. You can get around this warning in some contexts (for example, by setting environment variables in your terminal). In these cases, you may encounter SSL errors, and nothing happens when you run commands.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.strongdm.com/admin/resources/clouds/aws-instance-profile.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
