[ aws . s3control ]

create-access-grant

Description

Creates an access grant that gives a grantee access to your S3 data. The grantee can be an IAM user or role, a directory user or group, or an attribute. Before you can create a grant, you must have an S3 Access Grants instance in the same Region as the S3 data. You can create an S3 Access Grants instance using the CreateAccessGrantsInstance . You must also have registered at least one S3 data location in your S3 Access Grants instance using CreateAccessGrantsLocation .

Permissions

You must have the s3:CreateAccessGrant permission to use this operation.

Additional Permissions

To create a grant with an ApplicationArn , you must also have the sso:DescribeInstance permission. Other grants don’t require additional permissions.

See also: AWS API Documentation

Synopsis

  create-access-grant
--account-id <value>
--access-grants-location-id <value>
[--access-grants-location-configuration <value>]
--grantee <value>
--permission <value>
[--application-arn <value>]
[--s3-prefix-type <value>]
[--tags <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--debug]
[--endpoint-url <value>]
[--no-verify-ssl]
[--no-paginate]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--no-sign-request]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]
[--no-cli-pager]
[--cli-auto-prompt]
[--no-cli-auto-prompt]
[--cli-error-format <value>]
[--help]

Options

--account-id (string) [required]

The Amazon Web Services account ID of the S3 Access Grants instance.

Constraints:

  • max: 64
  • pattern: ^\d{12}$

--access-grants-location-id (string) [required]

The ID of the registered location to which you are granting access. S3 Access Grants assigns this ID when you register the location. S3 Access Grants assigns the ID default to the default location s3:// and assigns an auto-generated ID to other locations that you register.

If you are passing the default location, you cannot create an access grant for the entire default location. You must also specify a bucket or a bucket and prefix in the Subprefix field.

Constraints:

  • min: 1
  • max: 64
  • pattern: [a-zA-Z0-9\-]+

--access-grants-location-configuration (structure)

The configuration options of the grant location. The grant location is the S3 path to the data to which you are granting access. It contains the S3SubPrefix field. The grant scope is the result of appending the subprefix to the location scope of the registered location.

S3SubPrefix -> (string)

The S3SubPrefix is appended to the location scope creating the grant scope. Use this field to narrow the scope of the grant to a subset of the location scope. This field is required if the location scope is the default location s3:// because you cannot create a grant for all of your S3 data in the Region and must narrow the scope. For example, if the location scope is the default location s3:// , the S3SubPrefx can be a <bucket-name>/*, so the full grant scope path would be s3://<bucket-name>/* . Or the S3SubPrefx can be <bucket-name>/<prefix-name>* , so the full grant scope path would be or s3://<bucket-name>/<prefix-name>* .

If the S3SubPrefix includes a prefix, append the wildcard character * after the prefix to indicate that you want to include all object key names in the bucket that start with that prefix.

Constraints:

  • min: 1
  • max: 2000
  • pattern: ^.+$

Shorthand Syntax:

S3SubPrefix=string

JSON Syntax:

{
  "S3SubPrefix": "string"
}

--grantee (structure) [required]

The user, group, role, or attribute to which you are granting access. The grantee can be an IAM user or role, a directory user or group, or an attribute. A directory user or group comes from your corporate directory. Your users can sign in through IAM Identity Center or through IAM federation with trusted identity propagation (TIP) . IAM Identity Center instances use the legacy experience until you turn on the simplified experience for trusted identity propagation . If your instance uses the legacy experience, associate it with your S3 Access Grants instance.

GranteeType -> (string)

The type of the grantee to which access has been granted. It can be one of the following values:

  • IAM - An IAM user or role.
  • DIRECTORY_USER - A user from your corporate directory. The user can sign in through IAM Identity Center or through IAM federation with your external identity provider.
  • DIRECTORY_GROUP - A group from your corporate directory. Group grants match users who sign in through IAM Identity Center. They also match users who sign in through IAM federation when the IAM identity provider is configured for group-based access .
  • ATTRIBUTE - A runtime claim that you map on your IAM identity provider, such as a department. The grant matches every user who signs in through IAM federation with this runtime claim and value.

Possible values:

  • DIRECTORY_USER
  • DIRECTORY_GROUP
  • IAM
  • ATTRIBUTE

GranteeIdentifier -> (string)

The unique identifier of the Grantee . The format depends on the grantee type:

  • IAM - The IAM Amazon Resource Name (ARN) of the user or role.
  • DIRECTORY_USER - The user’s name, or the ID that IAM Identity Center uses for the user, for example, a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 . For IAM federation, the name is the subject that IAM sets from your identity provider token, for example, the user ID 00u1a2b3c4EXAMPLE . For IAM Identity Center, the name is the user’s username.
  • DIRECTORY_GROUP - The group’s display name in IAM Identity Center, for example, finance-analysts , or the group’s IAM Identity Center ID.
  • ATTRIBUTE - One runtime claim and its value, in the form aws:TransactionContext/IdentityProvider/*key* =*value* `` , for example, ``aws:TransactionContext/IdentityProvider/department=Finance . Each attribute grant contains one key and one value.

S3 Access Grants stores the identifier exactly as you enter it. It compares identifiers exactly, and the comparison is case sensitive. S3 Access Grants doesn’t check that the user, group, or attribute exists when you create the grant.

User names can be up to 128 characters long. They can contain letters, numbers, spaces, and the characters _ . : / = + - @ . Group names can be up to 128 characters long. They can contain any character that IAM Identity Center allows in a group display name, such as R&D or Finance (EU) . Attribute keys and values can each be up to 128 characters long. Both can contain letters, numbers, and the characters _ . : / + - @ . Values can also contain spaces and = . As a best practice, use an immutable user ID from your identity provider instead of an email address.

Shorthand Syntax:

GranteeType=string,GranteeIdentifier=string

JSON Syntax:

{
  "GranteeType": "DIRECTORY_USER"|"DIRECTORY_GROUP"|"IAM"|"ATTRIBUTE",
  "GranteeIdentifier": "string"
}

--permission (string) [required]

The type of access that you are granting to your S3 data, which can be set to one of the following values:

  • READ – Grant read-only access to the S3 data.
  • WRITE – Grant write-only access to the S3 data.
  • READWRITE – Grant both read and write access to the S3 data.

Possible values:

  • READ
  • WRITE
  • READWRITE

--application-arn (string)

The Amazon Resource Name (ARN) of an Amazon Web Services IAM Identity Center application associated with your Identity Center instance. If you include an application ARN in the request, the grantee can access the S3 data only through this application. This is an application-scoped grant. You can create one only for a directory user or group. Your S3 Access Grants instance must also be associated with an IAM Identity Center instance that uses the legacy experience, not the simplified experience for trusted identity propagation. Otherwise, the request fails with an InvalidRequest error.

Constraints:

  • min: 10
  • max: 1224
  • pattern: arn:[^:]+:sso::\d{12}:application/.*$

--s3-prefix-type (string)

The type of S3SubPrefix . The only possible value is Object . Pass this value if the access grant scope is an object. Do not pass this value if the access grant scope is a bucket or a bucket and a prefix.

Possible values:

  • Object

--tags (list)

The Amazon Web Services resource tags that you are adding to the access grant. Each tag is a label consisting of a user-defined key and value. Tags can help you manage, identify, organize, search for, and filter resources.

Constraints:

  • min: 0
  • max: 50

(structure)

A key-value pair that you use to label your resources. You can add tags to new resources when you create them, or you can add tags to existing resources. Tags can help you organize, track costs for, and control access to resources.

Key -> (string) [required]

The key of the key-value pair of a tag added to your Amazon Web Services resource. A tag key can be up to 128 Unicode characters in length and is case-sensitive. System created tags that begin with aws: aren’t supported.

Constraints:

  • min: 1
  • max: 128
  • pattern: ^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$

Value -> (string) [required]

The value of the key-value pair of a tag added to your Amazon Web Services resource. A tag value can be up to 256 Unicode characters in length and is case-sensitive.

Constraints:

  • min: 0
  • max: 256
  • pattern: ^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$

Shorthand Syntax:

Key=string,Value=string ...

JSON Syntax:

[
  {
    "Key": "string",
    "Value": "string"
  }
  ...
]

--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command. The generated JSON skeleton is not stable between versions of the AWS CLI and there are no backwards compatibility guarantees in the JSON skeleton generated.

Global Options

--debug (boolean)

Turn on debug logging.

--endpoint-url (string)

Override command’s default URL with the given URL.

--no-verify-ssl (boolean)

By default, the AWS CLI uses SSL when communicating with AWS services. For each SSL connection, the AWS CLI will verify SSL certificates. This option overrides the default behavior of verifying SSL certificates.

--no-paginate (boolean)

Disable automatic pagination. If automatic pagination is disabled, the AWS CLI will only make one call, for the first page of results.

--output (string)

The formatting style for command output.

  • json
  • text
  • table
  • yaml
  • yaml-stream
  • off

--query (string)

A JMESPath query to use in filtering the response data.

--profile (string)

Use a specific profile from your credential file.

--region (string)

The region to use. Overrides config/env settings.

--version (string)

Display the version of this tool.

--color (string)

Turn on/off color output.

  • on
  • off
  • auto

--no-sign-request (boolean)

Do not sign requests. Credentials will not be loaded if this argument is provided.

--ca-bundle (string)

The CA certificate bundle to use when verifying SSL certificates. Overrides config/env settings.

--cli-read-timeout (int)

The maximum socket read time in seconds. If the value is set to 0, the socket read will be blocking and not timeout. The default value is 60 seconds.

--cli-connect-timeout (int)

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

--cli-binary-format (string)

The formatting style to be used for binary blobs. The default format is base64. The base64 format expects binary blobs to be provided as a base64 encoded string. The raw-in-base64-out format preserves compatibility with AWS CLI V1 behavior and binary values must be passed literally. When providing contents from a file that map to a binary blob fileb:// will always be treated as binary and use the file contents directly regardless of the cli-binary-format setting. When using file:// the file contents will need to properly formatted for the configured cli-binary-format.

  • base64
  • raw-in-base64-out

--no-cli-pager (boolean)

Disable cli pager for output.

--cli-auto-prompt (boolean)

Automatically prompt for CLI input parameters.

--no-cli-auto-prompt (boolean)

Disable automatically prompt for CLI input parameters.

--cli-error-format (string)

The formatting style for error output. By default, errors are displayed in enhanced format.

  • legacy
  • json
  • yaml
  • text
  • table
  • enhanced

--help (boolean)

Display help for the command/subcommand.

Output

CreatedAt -> (timestamp)

The date and time when you created the access grant.

AccessGrantId -> (string)

The ID of the access grant. S3 Access Grants auto-generates this ID when you create the access grant.

Constraints:

  • min: 1
  • max: 64
  • pattern: [a-zA-Z0-9\-]+

AccessGrantArn -> (string)

The Amazon Resource Name (ARN) of the access grant.

Constraints:

  • min: 1
  • max: 2048
  • pattern: arn:[a-z\-]+:s3:[a-z0-9\-]+:\d{12}:access\-grants\/grant/[a-zA-Z0-9\-]+

Grantee -> (structure)

The user, group, role, or attribute to which you are granting access. The grantee can be an IAM user or role, a directory user or group, or an attribute. A directory user or group comes from your corporate directory. Your users can sign in through IAM Identity Center or through IAM federation with trusted identity propagation (TIP) . IAM Identity Center instances use the legacy experience until you turn on the simplified experience for trusted identity propagation . If your instance uses the legacy experience, associate it with your S3 Access Grants instance.

GranteeType -> (string)

The type of the grantee to which access has been granted. It can be one of the following values:

  • IAM - An IAM user or role.
  • DIRECTORY_USER - A user from your corporate directory. The user can sign in through IAM Identity Center or through IAM federation with your external identity provider.
  • DIRECTORY_GROUP - A group from your corporate directory. Group grants match users who sign in through IAM Identity Center. They also match users who sign in through IAM federation when the IAM identity provider is configured for group-based access .
  • ATTRIBUTE - A runtime claim that you map on your IAM identity provider, such as a department. The grant matches every user who signs in through IAM federation with this runtime claim and value.

Possible values:

  • DIRECTORY_USER
  • DIRECTORY_GROUP
  • IAM
  • ATTRIBUTE

GranteeIdentifier -> (string)

The unique identifier of the Grantee . The format depends on the grantee type:

  • IAM - The IAM Amazon Resource Name (ARN) of the user or role.
  • DIRECTORY_USER - The user’s name, or the ID that IAM Identity Center uses for the user, for example, a1b2c3d4-5678-90ab-cdef-EXAMPLE11111 . For IAM federation, the name is the subject that IAM sets from your identity provider token, for example, the user ID 00u1a2b3c4EXAMPLE . For IAM Identity Center, the name is the user’s username.
  • DIRECTORY_GROUP - The group’s display name in IAM Identity Center, for example, finance-analysts , or the group’s IAM Identity Center ID.
  • ATTRIBUTE - One runtime claim and its value, in the form aws:TransactionContext/IdentityProvider/*key* =*value* `` , for example, ``aws:TransactionContext/IdentityProvider/department=Finance . Each attribute grant contains one key and one value.

S3 Access Grants stores the identifier exactly as you enter it. It compares identifiers exactly, and the comparison is case sensitive. S3 Access Grants doesn’t check that the user, group, or attribute exists when you create the grant.

User names can be up to 128 characters long. They can contain letters, numbers, spaces, and the characters _ . : / = + - @ . Group names can be up to 128 characters long. They can contain any character that IAM Identity Center allows in a group display name, such as R&D or Finance (EU) . Attribute keys and values can each be up to 128 characters long. Both can contain letters, numbers, and the characters _ . : / + - @ . Values can also contain spaces and = . As a best practice, use an immutable user ID from your identity provider instead of an email address.

AccessGrantsLocationId -> (string)

The ID of the registered location to which you are granting access. S3 Access Grants assigns this ID when you register the location. S3 Access Grants assigns the ID default to the default location s3:// and assigns an auto-generated ID to other locations that you register.

Constraints:

  • min: 1
  • max: 64
  • pattern: [a-zA-Z0-9\-]+

AccessGrantsLocationConfiguration -> (structure)

The configuration options of the grant location. The grant location is the S3 path to the data to which you are granting access.

S3SubPrefix -> (string)

The S3SubPrefix is appended to the location scope creating the grant scope. Use this field to narrow the scope of the grant to a subset of the location scope. This field is required if the location scope is the default location s3:// because you cannot create a grant for all of your S3 data in the Region and must narrow the scope. For example, if the location scope is the default location s3:// , the S3SubPrefx can be a <bucket-name>/*, so the full grant scope path would be s3://<bucket-name>/* . Or the S3SubPrefx can be <bucket-name>/<prefix-name>* , so the full grant scope path would be or s3://<bucket-name>/<prefix-name>* .

If the S3SubPrefix includes a prefix, append the wildcard character * after the prefix to indicate that you want to include all object key names in the bucket that start with that prefix.

Constraints:

  • min: 1
  • max: 2000
  • pattern: ^.+$

Permission -> (string)

The type of access that you are granting to your S3 data, which can be set to one of the following values:

  • READ – Grant read-only access to the S3 data.
  • WRITE – Grant write-only access to the S3 data.
  • READWRITE – Grant both read and write access to the S3 data.

Possible values:

  • READ
  • WRITE
  • READWRITE

ApplicationArn -> (string)

The Amazon Resource Name (ARN) of an Amazon Web Services IAM Identity Center application associated with your Identity Center instance. If the grant includes an application ARN, the grantee can only access the S3 data through this application.

Grants with an application ARN match only users who sign in through an IAM Identity Center instance that uses the legacy experience, not the simplified experience for trusted identity propagation.

Constraints:

  • min: 10
  • max: 1224
  • pattern: arn:[^:]+:sso::\d{12}:application/.*$

GrantScope -> (string)

The S3 path of the data to which you are granting access. It is the result of appending the Subprefix to the location scope.

Constraints:

  • min: 1
  • max: 2000
  • pattern: ^.+$