Skip to content
Last9 Last9

Create a AWS STS Role

This tutorial walks through setting up a AWS STS (Secure Token Service) role for discovering resources via cloudwatch

Creating trusted role without external id

  1. Visit AWS Console/Roles

  2. Click Create Role ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_1.22.54_PM.png

  3. Select Another AWS Account tab

    • Account ID: 652845092827
    • Next Permissions ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_1.24.53_PM.png
  4. Attach policies

    a. SecurityAudit Policy

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_1.33.46_PM.png

    b. CloudWatchReadOnlyAccess Policy

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_2.42.11_PM.png

    c. Proceed to Next Steps

  5. Add tags if needed

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_1.37.36_PM.png

  6. Review

    1. Role name: ${business_name}_last9_role
    2. Role description: Security Audit Access to Last9
    3. Verify Last9 AWS Account Number
    4. Verify Granted Policy
    5. Create Role

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_1.44.40_PM.png

  7. After the role is created, Go to Role → Trust Relationships → Edit Trust Relationship

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/2021-06-08_22-08.png

  8. Update the JSON to the following and click “Update Trust Policy

    {
    "Version": "2012-10-17",
    "Statement": [
    {
    "Effect": "Allow",
    "Principal": {
    "AWS": "arn:aws:iam::652845092827:root"
    },
    "Action": "sts:AssumeRole",
    "Condition": {}
    }
    ]
    }
  9. Edit the role and update “Maximum session duration” to 3 hours if your security policy permits it. Else leave it as 1 hour.

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/2021-02-25_14-14.png

  10. Share the created role ARN with your Last9 point of contact


Creating trusted role with external id

  1. Visit AWS Console/Roles

  2. Click Create Role

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_1.22.54_PM.png

  3. Select “Another AWS Account” tab with external ID as a random string. It has to be something other than “somerandomstring” and share it with Last9

    • Account ID: 652845092827

    2021-09-08_17-24.png

  4. Attach policies

    a. SecurityAudit Policy

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_1.33.46_PM.png

    b. CloudWatchReadOnlyAccess Policy

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_2.42.11_PM.png

    c. Proceed to Next Steps

  5. Add tags if needed

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_1.37.36_PM.png

  6. Review

    1. Role name: ${business_name}_last9_role
    2. Role description: Security Audit Access to Last9
    3. Verify Last9 AWS Account Number
    4. Verify Granted Policy
    5. Create Role

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/Screenshot_2021-02-25_at_1.44.40_PM.png

  7. After the role is created, Go to Role → Trust Relationships → Edit Trust Relationship

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/2021-06-08_22-08.png

  8. Update the JSON to the following and click “Update Trust Policy”. Ensure that the value for sts:ExternalId matches the value set earlier for External-ID

    {
    "Version": "2012-10-17",
    "Statement": [
    {
    "Effect": "Allow",
    "Principal": {
    "AWS": "arn:aws:iam::652845092827:root"
    },
    "Action": "sts:AssumeRole",
    "Condition": {
    "StringEquals": {
    "sts:ExternalId": "somerandomstring"
    }
    }
    }
    ]
    }
  9. Edit the role and update “Maximum session duration” to 3 hours if your security policy permits it. Else leave it as 1 hour

    ../../../../assets/docs/tutorials/how-to-create-aws-sts-role/2021-02-25_14-14.png

  10. Share the created role ARN and external ID string with your Last9 point of contact