Supported IAM Policy Elements and Conditions
  • 05 Nov 2026
  • Dark
    Light

Supported IAM Policy Elements and Conditions

  • Dark
    Light

Article summary

Backblaze IAM uses AWS-compatible JSON policies to control access to IAM resources and Backblaze B2 Cloud Storage. This article describes the supported policy elements, condition operators, condition keys, and policy variables, including limitations that differ from AWS IAM.

Availability: Your Backblaze account must have IAM enabled. Contact Backblaze Support or your account representative to request access.

Backblaze supports a subset of AWS IAM policy functionality. Support for a policy element does not mean that every AWS API operation or condition key is available for every request.

Understand Policy Evaluation

Backblaze evaluates applicable policies when a principal makes a request:

  • An Allow statement can grant access when its action, resource, principal (where applicable), and conditions match.

  • An applicable explicit Deny overrides an Allow.

  • If no applicable statement grants permission, Backblaze denies the request by default.

Conditions limit when a statement matches. A statement whose conditions do not match does not grant access, but another applicable statement might. Consider all applicable policies when determining whether a request is authorized.

Choose a Policy Type

Policy type

Principal and resource requirements

Inline user or role policy

The user or role that owns the policy is the principal. Do not specify Principal or NotPrincipal. Use Resource or NotResource to identify resources.

Role trust policy

Specify Principal to identify who can assume the role. Do not specify NotPrincipal, Resource, or NotResource; the role is the implicit resource.

Bucket policy

Specify Principal or NotPrincipal. Use only resource ARNs for the target bucket or objects in that bucket. NotPrincipal applies only to Deny statements.

Backblaze also supports session policies supplied through supported STS operations. A session policy can restrict the permissions available to a role session; it cannot grant permissions beyond those available to the role.

Use Supported Policy Elements

Element

Support and behavior

Version

Supported. Use 2012-10-17 to enable policy variables. Static policies can use 2008-10-17 or omit Version, but variables remain literal in those cases.

Id

Supported. Optional, nonempty policy-level identifier. Does not affect authorization.

Statement

Supported and required. Include one or more statements as an object or an array.

Sid

Supported. Optional statement ID. Use only alphanumeric characters and a unique value within the policy.

Effect

Supported. Use Allow or Deny.

Action

Supported. Match named actions or action patterns. Use a string or an array of strings.

NotAction

Supported. Match actions other than the specified exclusions. Do not combine Action and NotAction in one statement.

Resource

Supported in identity and resource policies. Select resources using ARNs or wildcards.

NotResource

Supported in identity and resource policies. Select resources outside the specified exclusions. Do not combine Resource and NotResource in one statement.

Condition

Supported. Specify all conditions for a statement in a single Condition object.

An action pattern can match only operations that Backblaze supports. In a bucket policy, resource ARNs must refer to the bucket that owns the policy.

Specify Principals

The supported Principal format depends on the policy type.

Principal form

Use

{"AWS":"arn:aws:iam::123456789012:user/report-reader"}

Match a specific IAM user.

{"AWS":"arn:aws:iam::123456789012:role/report-reader"}

Match a role, including its assumed-role sessions in positive Principal matching.

{"AWS":"arn:aws:sts::123456789012:assumed-role/report-reader/example-session"}

Match one specific role session.

{"AWS":"123456789012"}

Delegate to a Backblaze account. The caller still needs the applicable permissions.

{"AWS":"arn:aws:iam::123456789012:root"}

Delegate to the account, not only the root user.

{"AWS":"*"}

The * wildcard matches any AWS-compatible caller principal, including IAM users and assumed-role sessions from any account. Supported in role trust policies and bucket policies. The caller must still satisfy applicable permissions and policy conditions.

"*"

Match all principals in a bucket policy. Use caution: this can make resources accessible beyond the intended audience. Restrict broad grants with appropriate conditions.

{"Service":"orgs.backblaze.com"}

Match the directly calling Backblaze Organizations service principal. This does not imply support for arbitrary AWS service principals.

Do not use partial wildcards within principal ARNs. The CanonicalUser principal form is not supported in the bucket-policy matching described here.

Bucket policies support NotPrincipal only with Effect: Deny. An exclusion from a Deny does not grant permission. When excluding a role session, account for both the role ARN and the relevant assumed-role session ARN. You can also use an ArnNotEquals condition on aws:PrincipalArn when that better expresses the intended restriction.

Use Policy Conditions

Place all the conditions for a statement in one Condition object. Backblaze combines different operators and condition keys with logical AND. Each JSON object must use unique keys.

For example, the following condition block matches only when the request uses TLS and the caller's existing session contains Team=blue:

"Condition": {
  "StringEquals": {
    "aws:PrincipalTag/Team": "blue"
  },
  "Bool": {
    "aws:SecureTransport": "true"
  }
}

This is a condition block for use inside a policy statement, not a complete policy document.

Supported Condition Operators

Operator

Behavior

StringEquals, StringNotEquals

Case-sensitive string comparison and its negation.

StringEqualsIgnoreCase, StringNotEqualsIgnoreCase

Case-insensitive string comparison and its negation.

StringLike, StringNotLike

Case-sensitive pattern matching with * and ?, and its negation.

ArnEquals, ArnNotEquals, ArnLike, ArnNotLike

Case-sensitive, ARN-segment-aware comparison. The Equals and Like forms share wildcard matching behavior, as do the negated forms.

Bool

Compare a registered Boolean key using the quoted value "true" or "false".

NumericEquals, NumericNotEquals, NumericLessThan, NumericLessThanEquals, NumericGreaterThan, NumericGreaterThanEquals

Compare numeric values. Quote numeric values in policies, including values in arrays. Do not use unquoted JSON numbers.

DateEquals, DateNotEquals, DateLessThan, DateLessThanEquals, DateGreaterThan, DateGreaterThanEquals

Compare registered date values using quoted ISO 8601 timestamps or epoch seconds.

Null

Test whether a condition key is absent ("true") or present ("false"). Specify one value, not an array.

IpAddress, NotIpAddress

Supported with limitations. Compare a resolved request IP address with an address or CIDR range. See the IP address restrictions below.

Use the operator that corresponds to the condition key's value type. For example, Bool works with registered Boolean keys, not tag values that happen to contain the text true. Numeric and date operators do not expand policy variables.

Handle Missing Condition Keys

A condition key is available only when Backblaze can determine its value for the request. For example, aws:username is available for IAM user credentials but not for assumed-role sessions.

Positive string, ARN, and IP comparisons generally do not match when the key is absent. Some negated comparisons can match an absent key. If a negated condition requires the key to exist, add a Null check with "false" for that key.

An expected-value array does not create a multivalued request key. ForAnyValue: and ForAllValues: qualifiers are not supported.

IP Address Restrictions

Backblaze supports IpAddress and NotIpAddress conditions for both IPv4 and IPv6, with limitations. Use IPv4 CIDR ranges to match IPv4 requests and IPv6 CIDR ranges to match IPv6 requests. Do not assume that a CIDR range for one address family restricts requests from the other.

The aws:SourceIp key identifies the source address available to Backblaze. When a request passes through a proxy or CDN, this may be the proxy or CDN address rather than the original client's address. Do not treat unverified forwarding headers as an authenticated client address.

Use Supported Condition Keys

Condition keys depend on the identity, credentials, operation, resource, and request. A key's presence in this table does not mean it is available for every operation.

Condition key

Availability and behavior

aws:PrincipalArn

IAM user ARN or, for an assumed-role session, the underlying IAM role ARN rather than the STS session ARN.

aws:PrincipalAccount

Account ID of the authenticated caller. Do not confuse it with the resource owner's account.

aws:PrincipalType

Caller identity type. The documented ordinary caller values are User and AssumedRole.

aws:username

IAM username when a request uses an IAM user's long-term access key. Absent for role sessions.

aws:userid

Unique user ID or role-ID:session-name for an assumed-role session.

aws:PrincipalIsAWSService

Whether a service principal directly authenticates the request. A role session issued to a service is not itself a direct service principal.

aws:PrincipalServiceName

Name of the directly calling service principal. Not available for ordinary IAM users or role sessions.

aws:SourceIdentity

Source identity already associated with the calling temporary session, if present.

sts:SourceIdentity

Source identity requested during the current supported STS authorization, including AssumeRole, AssumeRoleWithWebIdentity, and SetSourceIdentity. Not available for TagSession.

aws:RequestTag/<TagKey>

Tag supplied in a supported request, such as a session tag on AssumeRole. Does not imply support for IAM resource-tagging APIs.

aws:PrincipalTag/<TagKey>

Tag already associated with the calling role session. Support for arbitrary IAM user resource tags is not established.

aws:ResourceAccount

Account ID that owns the requested resource. For S3 requests, Backblaze determines ownership from the bucket.

aws:SourceIp

Supported with limitations. Resolved request source IP, which may belong to a proxy or CDN.

aws:SecureTransport

Whether the incoming request uses TLS; does not describe every previous proxy hop.

aws:CurrentTime

Time when Backblaze evaluates the policy.

aws:EpochTime

Policy evaluation time as Unix epoch seconds; use quoted numeric values for comparisons.

aws:TokenIssueTime

Issue time of the calling temporary credentials. Absent for long-term IAM user credentials and direct service principals.

aws:UserAgent

Value of the request's User-Agent header, when present. Client-controlled and not reliable proof of identity.

aws:Referer

Value of the request's Referer header, when present. Client-controlled, potentially absent, and not reliable proof of identity.

Use Policy Variables

Policies with "Version": "2012-10-17" can substitute an available single-valued condition key by using the ${...} expression. Backblaze supports substitution for an entire policy string or within supported condition strings and resource paths.

For example, this inline role policy allows a session with Team=blue to retrieve objects under the teams/blue/ prefix:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::example-reports/teams/${aws:PrincipalTag/Team}/*",
      "Condition": {
        "Null": {
          "aws:PrincipalTag/Team": "false"
        }
      }
    }
  ]
}

The session must already contain the Team tag. The Null condition checks that the key is present. If the tag is absent, the statement does not grant access.

Variable values cannot substitute for the service, region, or account components of a resource ARN. Backblaze treats * and ? characters within substituted values as literal characters, not wildcards. If a referenced value is missing, substitution does not create an unconditional grant.

If a policy omits Version or specifies 2008-10-17, Backblaze treats variable expressions as literal text. Static policy statements can still work with those versions.

Review Policy Examples

The following examples illustrate policy matching. The final result also depends on other applicable policies and permissions.

Allow Access to a Bucket from an Identity Policy

Attach this policy to an IAM user or role to allow bucket listing and object access for example-reports:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::example-reports"
    },
    {
      "Effect": "Allow",
      "Action": ["s3:GetObject", "s3:PutObject", "s3:DeleteObject"],
      "Resource": "arn:aws:s3:::example-reports/*"
    }
  ]
}

The policy does not specify Principal because the attached identity is implicit. Other applicable policies can still restrict or deny the operations.

Require a Session Tag in a Role Trust Policy

The following role trust policy requires the IAM user report-reader to request Team=blue when calling AssumeRole. It authorizes TagSession in a separate statement:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::123456789012:user/report-reader"
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringEquals": {
          "aws:RequestTag/Team": "blue"
        }
      }
    },
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::123456789012:user/report-reader"
      },
      "Action": "sts:TagSession"
    }
  ]
}

The request must include the matching session tag and satisfy the other authorization requirements. Authorizing TagSession separately avoids applying the tag-value condition to an action that does not provide that condition key.

Deny Other Principals in a Bucket Policy

This bucket policy denies s3:GetObject for principals other than the report-reader role:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Deny",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::example-reports/reports/summary.csv",
      "Condition": {
        "ArnNotEquals": {
          "aws:PrincipalArn": "arn:aws:iam::123456789012:role/report-reader"
        }
      }
    }
  ]
}

When a session associated with report-reader makes the request, Backblaze uses the underlying role ARN for aws:PrincipalArn. The policy denies access to the object for all other principals. The report-reader role is exempt from this denial but still requires an applicable Allow statement to access the object.

Unsupported Policy Features

Do not use the following constructs in Backblaze IAM policies:

Construct

Restriction

Principal and NotPrincipal in inline user or role policies

The attached user or role is implicit.

NotPrincipal in role trust policies

Use a supported Principal configuration instead.

BinaryEquals

Binary condition matching is not supported.

...IfExists

Condition operator suffixes such as StringEqualsIfExists are not supported.

ForAnyValue: and ForAllValues:

Set qualifiers are not supported.

aws:ResourceTag/<TagKey>

Resource-tag condition values are not available.

aws:TagKeys

Tag-key enumeration is not supported.

Multivalued condition keys

Supported request-context keys are single-valued.

Policy variable substitution with an omitted or 2008-10-17 Version

Variable expansion is not supported in those documents; static policies remain valid.

Do not assume that support for session tags means Backblaze supports every AWS IAM tagging operation. Likewise, valid policy syntax does not guarantee that a condition key is available for a particular request or that an unsupported API operation becomes available.

Additional Resources


Was this article helpful?