POSThttps://api.spotinst.io/setup/access/policy?accountId={ACCOUNT_ID}

Create an access policy. access policy enables you to define the user’s permissions on a granular level than the role-based permissions.

Parameter Type Description
ACCOUNT_ID * String

The Spotinst accountId

Example: act-1234cds
Request

Headers
Copied!
Downloaded!
{
"Content-Type": "application/json",
"Authorization": "Bearer ${token}"
}
Body
Copied!
Downloaded!
{
  "policy": {
    "name": "my policy",
    "description": "description of my policy",
    "policyContent": {
      "statements": [
        {
          "effect": "ALLOW",
          "actions": [
            "ocean:importCluster"
          ],
          "resources": [
            "*"
          ]
        },
        {
          "effect": "ALLOW",
          "actions": [
            "emr:scale"
          ],
          "resources": [
            "*"
          ]
        }
      ]
    }
  }
}
Attribute Type Description
policy * Object

Set access policy settings

Example: Acme, Inc.
policy.name * String

Set access policy name

policy.description String

Set access policy description

policy.policyContent * Object

Set permissions objects list

policy.policyContent.statements * Array<Object>

List of permissions statements

policy.policyContent.statements.effect String

Valid values: "ALLOW", "DENY"

Example: ALLOW
policy.policyContent.statements.actions * Array<String>

Set a list of required actions for this permissions statement. full list of actions can be found here.

Example: emr:scale
policy.policyContent.statements.resources * Array<String>

Set a list of resources IDs. In order to include all resources in this statement - use "*"

Response - 200

Headers
Copied!
Downloaded!
{
  "Content-Type": "application/json"
}
Body
Copied!
Downloaded!
{
  "name": "my policy",
  "description": "description of my policy",
  "policyContent": {
    "statements": [
      {
        "effect": "ALLOW",
        "actions": [
          "ocean:importCluster"
        ],
        "resources": [
          "*"
        ]
      },
      {
        "effect": "ALLOW",
        "actions": [
          "emr:scale"
        ],
        "resources": [
          "*"
        ]
      }
    ]
  },
  "id": "pol-c3e30574"
}