Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
© 2022 Yandex.Cloud LLC
Yandex Serverless Containers
  • Comparison with other Yandex Cloud services
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Getting an IAM token for a service account
    • Managing a container
      • Creating a container
      • Getting a container list
      • Managing container revisions
      • Managing container access rights
      • Invoking a container
      • Updating a container
      • Monitoring
      • Viewing the execution log
      • Deleting a container
  • Concepts
    • Overview
    • Container
    • Invoking a container
    • Runtime environment
    • Container logs
    • Backups
    • Quotas and limits
  • Access management
  • Pricing policy
  • Questions and answers
  1. Step-by-step instructions
  2. Managing a container
  3. Managing container access rights

Managing container access rights

Written by
Yandex.Cloud
  • Making a container public
  • Making a container private
  • Viewing roles assigned to a container
  • Assigning roles to a container
  • Revoking roles assigned to a container

You can make a container public or private, view roles assigned to a container, revoke them, or assign new roles.

Making a container public

If you want any user to be able to invoke a container without passing the authorization header, make it public.

CLI

If you don't have the Yandex Cloud command line interface yet, install and initialize it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

To make a container public, run the command:

yc serverless container allow-unauthenticated-invoke <container_name>

Result:

done (1s)

Making a container private

For a container to be invoked only by users with rights to invoke it, make the container private.

Note

If all unauthorized users (the allUsers system group) of a cloud or folder are granted rights to invoke a container, the container will be public regardless of the settings. How to revoke a role.

CLI

To make a container private, run the command:

yc serverless container deny-unauthenticated-invoke <container_name>

Result:

done (1s)

Viewing roles assigned to a container

CLI

To view roles assigned to a container, run the command:

yc serverless container list-access-bindings --name=<container_name>

Result:

+---------+--------------+-----------------------+
| ROLE ID | SUBJECT TYPE |      SUBJECT ID       |
+---------+--------------+-----------------------+
| editor  | system       | allAuthenticatedUsers |
+---------+--------------+-----------------------+

Note

Roles assigned to a folder or cloud are automatically inherited by a container. However, they don't appear in the list of assigned roles. Learn more about viewing roles.

Assigning roles to a container

CLI

To assign a role to a container, run the command:

  • User:

    yc serverless container add-access-binding \
      --name <container_name> \
      --user-account-id <user_ID> \
      --role <role>
    

    Result:

    done (1s)
    
  • Service account:

    yc serverless container add-access-binding \
      --name <container_name> \
      --service-account-id <service_account_id> \
      --role <role>
    

    Result:

    done (1s)
    
  • All authorized users (allAuthenticatedUsers system group):

    yc serverless container add-access-binding \
      --name <container_name> \
      --all-authenticated-users \
      --role <role>
    

    Result:

    done (1s)
    

Revoking roles assigned to a container

CLI

To revoke a role for a container, run the command:

  • User:

    yc serverless container remove-access-binding \
      --name <container_name> \
      --user-account-id <user_ID> \
      --role <role>
    

    Result:

    done (1s)
    
  • Service account:

    yc serverless container remove-access-binding \
      --name <container_name> \
      --service-account-id <service_account_id> \
      --role <role>
    

    Result:

    done (1s)
    
  • All authorized users (allAuthenticatedUsers system group):

    yc serverless container remove-access-binding \
      --name <container_name> \
      --all-authenticated-users \
      --role <role>
    

    Result:

    done (1s)
    

Was the article helpful?

Language / Region
© 2022 Yandex.Cloud LLC
In this article:
  • Making a container public
  • Making a container private
  • Viewing roles assigned to a container
  • Assigning roles to a container
  • Revoking roles assigned to a container