Product lesson preview

AWS / EC2 Role Checklist

Connect your virtual computer (“EC2”) to the rest of AWS resources to make any app, website, etc. you can think of.

Here’s what to remember about permissions in AWS.

Policies
Roles
EC2

You add permissions to a policy.

You attach one or more policies to a role.

You attach one role to your EC2.

This gives your OpenClaw, which lives on an EC2 instance, access to AWS.

Progress 0 complete
Introduction (optional)

Why connecting EC2 to AWS matters

The very cool thing about having your bot on Amazon Web Services (AWS) EC2, which is basically a virtual computer in a datacenter somewhere, is that you can connect your EC2 to the rest of AWS architecture: websites, apps, databases, text and email tools, storage, automations, and almost anything else you can build on the internet.

You do not have to know how to build all of that yourself. Once this is connected, you can talk to your bot through Telegram and have it build on AWS for you.

We're going to get you set up. It is mostly about giving your EC2 access to write commands that build and execute code, enable settings, and do the same AWS work a human builder would do.

We will be setting a policy to allow our EC2 to touch the rest of AWS. That is the main idea.

Side note: this is why OpenClaw is different from a normal chatbot. Before tools like this, most people asked AI a question and copied the answer somewhere else. OpenClaw lets an AI bot control a computer, a browser, APIs, and connected services so it can send, create, edit, and act on your behalf.

That is how you get to a world where a bot texts you at 5 a.m. with a summary of your overnight email, you talk back through Telegram, and it drafts or sends the right replies after following the instructions you set. Less chat-copy-paste, more bot-as-extension of your work and life.

What you are building and how it works (optional)

An EC2 role with broad building power and practical guardrails

AWS permissions are just rules. A policy says what actions are allowed. A role collects those policies. EC2 receives that role through an instance profile. So the flow is not "attach a policy to EC2." The flow is: create an IAM role, attach policies to the role, then attach the role to the EC2 instance.

  • EC2 is where the OpenClaw server runs.
  • IAM stands for Identity and Access Management. It is where AWS permissions live.
  • Roles are the clean way to give AWS permissions to EC2.
  • PowerUserAccess gives broad build capability without full account administration.
  • Deny guardrails block account, billing, secrets, logging, and protected-data mistakes.

Right now, your fresh bot only has access to the EC2 server it runs on. It can update OpenClaw and work on that virtual computer, but it does not automatically have access to the rest of AWS to create websites, apps, databases, email tools, or other services.

In IAM, we are going to create a role that we can attach to EC2. That role is what gives EC2 access to more of AWS. A role is made up of policies.

  • Think of the role as the single permissions package you give the EC2. Like a finished Lego model.
  • Think of the policies as the individual permission blocks attached to that role. Like Lego building blocks.
Step 1

Create the EC2 deny policy

First, create the policy that denies the bot from touching certain parts of AWS: user/account settings, organizations, payment settings, security logging, keys, and secrets. This keeps the main policy short enough for a fresh AWS account while still blocking the areas the bot should not casually change.

Then copy the recommended core policy below and paste it into the JSON editor.

What this policy does: it keeps the bot from changing account and organization settings, changing payment or support-plan settings, turning off security logging, weakening encryption keys, or deleting/exposing stored secrets. We will describe more optional restrictions later in this checklist.

{
        "Version": "2012-10-17",
        "Statement": [
          {
            "Sid": "DenyAccountOrganizationsPaymentsAndSupportPlanChanges",
            "Effect": "Deny",
            "Action": [
              "account:CloseAccount",
              "account:Delete*",
              "account:DisableRegion",
              "account:EnableRegion",
              "account:Put*",
              "aws-portal:Modify*",
              "billing:Create*",
              "billing:Delete*",
              "billing:Put*",
              "billing:Update*",
              "consolidatedbilling:*",
              "invoicing:Create*",
              "invoicing:Delete*",
              "invoicing:Put*",
              "invoicing:Update*",
              "organizations:*",
              "payments:*",
              "purchase-orders:*",
              "supportplans:*",
              "tax:*"
            ],
            "Resource": "*"
          },
          {
            "Sid": "DenySecurityLoggingTampering",
            "Effect": "Deny",
            "Action": [
              "cloudtrail:DeleteTrail",
              "cloudtrail:StopLogging",
              "cloudtrail:UpdateTrail",
              "cloudtrail:PutEventSelectors",
              "cloudtrail:PutInsightSelectors",
              "config:DeleteConfigurationRecorder",
              "config:DeleteDeliveryChannel",
              "config:StopConfigurationRecorder",
              "guardduty:DeleteDetector",
              "guardduty:UpdateDetector",
              "securityhub:DisableSecurityHub",
              "securityhub:BatchDisableStandards"
            ],
            "Resource": "*"
          },
          {
            "Sid": "DenyKMSAndSecretsDestructionOrExposure",
            "Effect": "Deny",
            "Action": [
              "kms:ScheduleKeyDeletion",
              "kms:DisableKey",
              "kms:DisableKeyRotation",
              "kms:DeleteAlias",
              "kms:PutKeyPolicy",
              "secretsmanager:DeleteSecret",
              "secretsmanager:PutResourcePolicy",
              "secretsmanager:UpdateSecretVersionStage"
            ],
            "Resource": "*"
          }
        ]
      }
Step 2

Create the IAM role

Great work. You created the IAM deny policy. Now we will create the role that we will apply to our EC2. Read the explanation above again if roles and policies are still fuzzy.

A role is like the PB&J. The jelly is the first policy we will add: PowerUserAccess. That is the sweet part that gives our EC2, and the OpenClaw running on it, access to AWS. By default, that policy does not have some permissions already; for example, it cannot add or change IAM roles.

But we want some peanut butter too, or sunbutter if your family is like mine, to balance all that sweet. That is the deny policy we just made. It takes away some of the PowerUserAccess permissions and reins them in a bit.

If this is a pre-existing AWS account with code and services already running, see here

Protect pre-existing AWS work before giving broad access to your bot

If you have existing AWS production services, sites, apps, databases, buckets, or other important resources, discuss that with your bot after this checklist is over and consider adding additional deny policies before giving the bot broad access.

You can also have your bot add notes in TOOLS.md or a project notes file telling it not to touch certain production data without your explicit approval. We will also cover that in the bonus add-on section on the next page.

Step 3

Navigate back to EC2 and attach the role

Now go back to the EC2 instance and attach the role you just created. This is the step that gives the actual virtual computer permission to use AWS.

Teaching moment: AWS CLI matters

Why AWS CLI matters

The AWS console is the website humans click through. The AWS CLI is the command-line tool your bot can use from the EC2 server. Once the EC2 role is attached, the bot can use the AWS CLI without you pasting long-term access keys into the machine.

That is the whole point of this lesson: EC2 gets the role, the role gets the policies, and the bot uses that access to build with AWS.

Step 4

Have your bot install or confirm AWS CLI

Now that the EC2 has the role, have your bot check whether AWS CLI is installed. If it is missing, the bot can install it. Then have the bot confirm it can access AWS through the EC2 role.

Please check whether AWS CLI is installed on this EC2 server.

      If AWS CLI is already installed:
      - tell me the installed version

      If AWS CLI is not installed:
      - install AWS CLI using the right commands for this server
      - then tell me the installed version

	      Then let me know if you have access to my AWS environment now.

	      If you do, make a tiny test webpage in S3 and publish it publicly so I can click the link you give me to see it.
Step 5

Start building by texting your bot!

Now your OpenClaw EC2 has permission to use AWS, and your bot has confirmed it can talk to AWS through the CLI. The next step is simple: start texting your bot about what you want to build.

For informational/review pages as you build, you can tell your bot to publish the work publicly so you can click a link in your bot chat and see what it built. It will have an obscure URL that humans will not normally find.

Next

Core AWS access is ready.

The main setup is done. The next page has bonus safeguards and field-tested bot rules you can add when you are ready.