Documentation

esc
    Move to Pantech / Connect AWS

    Connect an AWS account

    Give Pantech read-only access to an AWS account with a CloudFormation stack, without sharing any keys, then check, fix or remove the connection.

    Pantech reads your AWS account through a role you create in it. You never give Pantech an access key: Pantech proves who it is with a token it signs itself, and AWS swaps that token for credentials that last one hour and can only read. Security has every permission the role holds.

    You need permission in AWS to create a CloudFormation stack that makes IAM resources, and to be an Owner or Admin of your Pantech organization.

    How it works

    1. You create a connection in Pantech. It gets an id like ccn_06gk3x9tq7m2v8r4y1c5d0zp8w and the status awaiting role.
    2. You create a CloudFormation stack in your AWS account from the connection's template. It makes two things:
      • an IAM identity provider for Pantech's issuer (the URL in your connection's setup, issuer_url), with the audience pantech-migrate;
      • a read-only role that only a token for this one connection can assume.
    3. You paste the stack's RoleArn output into Pantech. The connection moves to verifying while Pantech assumes the role once and reads which AWS account it belongs to, usually within a minute.
    4. The connection is connected, ready to scan. If the check fails it is failed, with a reason and what to do.

    Create the stack

    Migrate is not in the console yet, so start the connection with the CLI, the API or your AI app. Then create the stack in AWS, either way:

    • One click: follow the link Pantech gives you. It opens CloudFormation's quick-create page with Pantech's template and your connection id filled in. Tick the box that lets the stack create IAM resources, and create it.
    • From the template: the CLI saves it for you, and the API returns it as setup.template. Create the stack in the CloudFormation console or with the AWS CLI (below). The template has your connection id written into it.

    Wait for the stack to reach CREATE_COMPLETE, open its Outputs tab, and copy RoleArn. Send it to Pantech; the connection is connected once the check passes.

    IAM is global, so the stack can live in any region. The one-click link opens us-east-1.

    With the CLI

    Terminal
    $ pantech migrate connect --name "Production AWS"$ pantech migrate set-role ccn_06gk3x9tq7m2v8r4y1c5d0zp8w --wait \    --role-arn arn:aws:iam::123456789012:role/PantechMigrate-PantechMigrateRole-1A2B3C4D5E6F$ pantech migrate connections

    connect saves the stack's template as pantech-migrate-<connection id>.json (--template-out names another file) and, when the one-click link is offered, prints it and opens it in your browser (--no-browser only prints it). set-role sends the role ARN; with --wait it waits for the check to finish. connections lists every connection and its status, and connection <id> shows one. If a check failed and you have fixed the cause, pantech migrate retry <connection> --wait checks again.

    To create the stack from the template with the AWS CLI:

    Terminal
    $ aws cloudformation create-stack --stack-name PantechMigrate \    --template-body file://pantech-migrate-ccn_06gk3x9tq7m2v8r4y1c5d0zp8w.json --capabilities CAPABILITY_IAM$ aws cloudformation wait stack-create-complete --stack-name PantechMigrate$ aws cloudformation describe-stacks --stack-name PantechMigrate \    --query "Stacks[0].Outputs[?OutputKey=='RoleArn'].OutputValue" --output text

    With the API

    Create the connection. provider is aws, the default when you leave it out. Its setup holds everything the stack needs:

    Terminal
    $ curl -X POST https://api.pantechdynamics.com/public/v1/cloud-connections \    -H "Authorization: Bearer $PANTECH_API_KEY" \    -H "Idempotency-Key: $(uuidgen)" \    -H "Content-Type: application/json" \    -d '{"provider": "aws", "name": "Production AWS"}'
    setup fieldWhat it is
    issuer_urlPantech's issuer: the URL the identity provider trusts. Use the value in your connection's setup, not one copied from these docs
    audiencepantech-migrate
    subjectThe connection's id: the only subject the role trusts
    templateThe CloudFormation template for this connection, as JSON text
    quick_create_urlThe one-click link, or null when there is none
    permissionsEvery read-only action the role holds, one by one

    Send the stack's output, then poll the connection until status is connected or failed:

    Terminal
    $ curl -X PATCH https://api.pantechdynamics.com/public/v1/cloud-connections/ccn_06gk3x9tq7m2v8r4y1c5d0zp8w \    -H "Authorization: Bearer $PANTECH_API_KEY" \    -H "Idempotency-Key: $(uuidgen)" \    -H "Content-Type: application/json" \    -d '{"role_arn": "arn:aws:iam::123456789012:role/PantechMigrate-PantechMigrateRole-1A2B3C4D5E6F"}'

    {"retry": true} checks a failed connection again, and {"name": "…"} renames it. To save an existing connection's template, GET /cloud-connections/{connection_id} and write out its setup.template (for example with jq -r .setup.template). Every field is in the API reference.

    The trust policy

    This is what decides who can use the role. The stack writes it for you. In this example, oidc.example.pantechdynamics.com/migrate stands for your connection's issuer_url without https://, and the account and connection ids are examples too:

    Trust policy
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Principal": {
            "Federated": "arn:aws:iam::123456789012:oidc-provider/oidc.example.pantechdynamics.com/migrate"
          },
          "Action": "sts:AssumeRoleWithWebIdentity",
          "Condition": {
            "StringEquals": {
              "oidc.example.pantechdynamics.com/migrate:aud": "pantech-migrate",
              "oidc.example.pantechdynamics.com/migrate:sub": "ccn_06gk3x9tq7m2v8r4y1c5d0zp8w"
            }
          }
        }
      ]
    }
    • Principal is the identity provider the stack created: only tokens signed by Pantech's issuer are accepted, checked against the keys Pantech publishes at the issuer URL.
    • aud must be pantech-migrate, so a Pantech token made for anything else is refused.
    • sub must be your connection's id. Pantech signs a token for one connection at a time, so a token for another customer's connection cannot assume your role, even if something went wrong on Pantech's side.
    • sts:AssumeRoleWithWebIdentity is the only way in, and no AWS user or service is trusted.

    Each token lives 5 minutes, and the credentials AWS gives for it last one hour (the role's MaxSessionDuration is 3600 seconds). Pantech uses them for one check or one scan, and keeps nothing.

    An account connected before

    AWS allows one identity provider per issuer in an account. If an earlier Pantech connection's stack already created it, creating a second stack fails, with CloudFormation saying the provider already exists, and rolls back.

    Set the template's CreateOIDCProvider parameter to false for the second stack. The new role then trusts the existing provider, and only the new connection's id:

    Terminal
    $ aws cloudformation create-stack --stack-name PantechMigrate-staging \    --template-body file://pantech-migrate-ccn_06gk3x9tq7m2v8r4y1c5d0zp8w.json --capabilities CAPABILITY_IAM \    --parameters ParameterKey=CreateOIDCProvider,ParameterValue=false

    Deleting a stack never deletes the identity provider: it is kept, so the other connections' roles keep working whichever stack you delete first. On its own it grants nothing, because only a role can be assumed. Once no Pantech connection uses it, you can delete it under IAM › Identity providers.

    If the check fails

    The connection shows failed with one of these codes:

    CodeWhat it meansWhat to do
    assume_role_deniedAWS would not let Pantech use the roleCheck the stack reached CREATE_COMPLETE, the ARN is the stack's RoleArn output (not another role), the stack was made for this connection (the sub in its trust policy is this connection's id), and the stack has not been deleted. Then retry
    permission_missingThe role is missing a permission Pantech needsUpdate the stack with the latest template from the connection, then retry
    provider_unavailableAWS did not answer in timeRetry in a few minutes
    internalSomething went wrong on Pantech's sideRetry; if it keeps happening, contact support

    A role ARN Pantech will not accept at all is refused straight away with INVALID_ROLE_ARN: it must look like arn:aws:iam::123456789012:role/name. Only the standard AWS partition can be connected. Troubleshooting has every code.

    Copy roles

    The role this stack creates can only read what you run, never what is inside it. Copying data needs a second role, in a second stack, that you create only if you want it:

    • Bucket copy access reads the objects of the buckets you choose, and nothing else.
    • The server copy role reads EBS snapshots tagged for this connection, and, if you allow it, snapshots the chosen volumes itself.

    Servers can also be copied with the agent on the server, which needs no copy role; Windows servers are copied that way only.

    Both trust the same identity provider, with a subject only copy work uses, so a scan's token cannot use them and a copy's token cannot use the read-only role.

    The agent, for copies

    Pantech scans this cloud itself, so a scan needs nothing installed. The copy steps that read from inside your network use the Pantech Migrate agent, which this connection can have too: copying a server from the server itself, importing a database and moving a Kubernetes cluster. Enroll it with POST /cloud-connections/{connection_id}/agent-enrollments or pantech migrate agent enroll <connection id>. Here it never scans and needs no AWS credential: only what each copy step needs, in its configuration.

    Disconnect

    Disconnecting takes two steps, one on each side:

    1. In Pantech, disconnect the connection: pantech migrate disconnect <connection>, DELETE /cloud-connections/{connection_id}, or ask your AI app. Its scans are deleted with it. Plans you made from it stay until you delete them.
    2. In AWS, delete the CloudFormation stack, and any copy stacks you made. That removes the roles, so nothing can read your account any more, whatever happens on Pantech's side. The identity provider is kept for other connections; delete it in IAM if you no longer need it.

    Deleting the stack alone also cuts access at once: the next check or scan fails with assume_role_denied.

    Was this page helpful?

    Updated