EN
EspañolEnglishFrançaisDeutschPortuguêsItaliano
Sign in Start free
IAM

How to create an IAM user with minimal permissions for an external panel (from CloudShell)

Create in AWS an access key that can only do the essentials (view, start and stop Lightsail machines, for example) to hand to a panel or an external tool, with four commands in CloudShell and without touching your main user.

⏱ 15 minutes ◎ Intermediate level Updated on 26/10/2026

Sooner or later an external tool asks you for "an AWS key": a control panel, a backup system, a monitor. The temptation is to copy your administrator user's key. Never do that. Whoever has that key can do everything you can do, including wiping the whole account. The right thing is to create a separate IAM user with a policy that allows only the specific actions that tool needs, and give it its own key.

We will do it from AWS CloudShell, the terminal built into the web console, because it is four copy-and-paste commands and the result is exact. There is nothing to install on your computer.

Before you start: what each thing means

IAM
The AWS service that manages who can do what in your account: users, keys and permissions.
IAM user
An identity inside your AWS account, separate from yours, to which you give only the permissions it needs. It can be for a person or for a program.
Policy
The list of permissions, written in a text format called JSON: which actions are allowed and on what. The guide gives it to you ready made.
Access key
The "username and password" for programs: two strings of text (identifier and secret) that a tool uses to talk to AWS on behalf of that user.
CloudShell
A terminal (black screen where you type commands) built into the AWS web console. Nothing to install: it opens already connected to your account.
Minimal permissions
The idea of giving each tool only the essentials. If the key leaks, the damage is limited to that.
ARN
The full, unique name of anything in AWS, of the form arn:aws:... It is used to refer to it unambiguously.
Role
An alternative to the user with a key: the tool "borrows" a temporary permission without any permanent password existing. Safer, if the tool supports it.

Step by step

  1. Decide which actions the tool needs

    Before writing anything, make the list. A panel that manages Lightsail machines will need, for example: to view the machines and their status, to start, stop and reboot them, and perhaps to create and view snapshots. It does not need to create or delete machines, see billing or touch users. Every action that is not on the list is an action you are not going to grant. If the tool is serious, it will tell you exactly which permissions it asks for; if it asks for "AdministratorAccess", be suspicious.

  2. Open CloudShell

    In the AWS console, click the terminal icon in the top bar (CloudShell) or search for it by name. It takes a few seconds to start. You now have a Linux terminal with the aws tool configured with your current credentials, so everything you do there you do as the user you are signed in to the console with (who must have permission to manage IAM).

  3. Write the policy

    Create a file with the policy in JSON format. This example allows viewing, starting, stopping and rebooting Lightsail machines and managing their snapshots, nothing else. Paste the whole block into CloudShell:

    cat > politica.json <<'FIN'
    {
      "Version": "2012-10-17",
      "Statement": [{
        "Effect": "Allow",
        "Action": [
          "lightsail:GetInstances", "lightsail:GetInstance", "lightsail:GetInstanceState",
          "lightsail:GetInstanceMetricData", "lightsail:GetRegions",
          "lightsail:StartInstance", "lightsail:StopInstance", "lightsail:RebootInstance",
          "lightsail:GetInstanceSnapshots", "lightsail:GetInstanceSnapshot",
          "lightsail:CreateInstanceSnapshot", "lightsail:DeleteInstanceSnapshot"
        ],
        "Resource": "*"
      }]
    }
    FIN

    Each action is called servicio:Operación. If you only want the tool to view, remove the Start, Stop, Reboot, Create and Delete lines. For EC2, S3 or RDS the actions have other names, but the mechanics are identical. In Lightsail most actions cannot be limited to one specific machine, which is why the Resource is *; in EC2 or S3 you can put the exact identifier of the resource.

  4. Create the policy and the user, and attach them

    Three commands. Change the name if you like, but make it say what it is for:

    aws iam create-policy --policy-name PanelMaquinas --policy-document file://politica.json
    aws iam create-user --user-name panel-maquinas
    CUENTA=$(aws sts get-caller-identity --query Account --output text)
    aws iam attach-user-policy --user-name panel-maquinas \
      --policy-arn arn:aws:iam::$CUENTA:policy/PanelMaquinas

    The first command returns the policy's ARN; the third rebuilds it with your account number so you do not have to copy it. Note that we do not give the user a console password: it will exist only for the access key.

  5. Generate the access key

    aws iam create-access-key --user-name panel-maquinas

    The response brings two values: AccessKeyId (starts with AKIA) and SecretAccessKey. The secret is shown only this once. Copy it straight into the tool that is going to use it. Do not paste it into an email, a chat or a shared document. If you lose it, no harm done: delete that key and create another.

  6. Delete the file and check

    rm politica.json
    aws iam list-attached-user-policies --user-name panel-maquinas

    Only PanelMaquinas should appear. Configure the tool with the key and try one allowed action (view machines) and one that is not allowed (create one): the second must fail with "not authorized". That error is the proof that you did the job right.

What can go wrong

The tool says it has no permission for something you do want

An action is missing from the policy. The AWS error message says exactly which one (User ... is not authorized to perform: lightsail:GetBundles). Add it to the JSON and update the policy with aws iam create-policy-version --set-as-default, or edit it from the IAM console. Add only that action; do not open the door wide again.

I pasted the secret somewhere I should not have

Consider it leaked. In CloudShell: aws iam delete-access-key --user-name panel-maquinas --access-key-id AKIA... and create another. Since the user has minimal permissions, the possible damage was small; that is the whole point of this.

The third command fails on the ARN

Your console user may not have permission for sts:GetCallerIdentity (rare) or the policy name may have a typo. Copy the ARN the first command returned and paste it by hand into --policy-arn.

Would a role not be better than a user?

Yes, when the tool supports it: an IAM role that the tool assumes from its own AWS account has no key to leak and the credentials expire on their own. Ask your provider whether it supports "role-based access" or a "cross-account role". If not, the user with minimal permissions is the second best option, and far better than the administrator key.

In Simplio

In Simplio you do not have to write the policy: in the help you tick boxes for what you want to allow (view only, no firewall, no terminal, one region...) and it generates the JSON and the complete script to paste into CloudShell, which returns the key ready made. And if you would rather avoid keys, Simplio supports connecting by role, with temporary credentials that expire in one hour. The key is stored encrypted and is never shown again.

The same task, in AWS and in Simplio

In the AWS consoleIn Simplio
Write the policyKnow the exact name of each AWS action and the JSON formatTick boxes (view only, no firewall, no terminal, one region): the JSON generates itself
Create user, policy and keyCloudShell, 4 commands, 15 minutes the first timePaste into CloudShell the script the help generates: 2 minutes
If you do not want keysDesign a cross-account role by handConnection by role with an ARN that Simplio generates for you

Try it free for 15 days See how it works

All of this, without the AWS console

Simplio is a panel to manage your AWS accounts: machines, scheduled copies, databases, domains, email and what AWS charges you, with per-person permissions and two-factor. Nothing installed on your servers.

Start free for 15 days, no card

Already a customer? Customer access.