- NAME
-
- gcloud compute instances set-iam-policy - set IAM policy for a Google Compute Engine instance
- SYNOPSIS
-
-
gcloud compute instances set-iam-policy( INSTANCE:--zone=ZONE)POLICY_FILE[ GCLOUD_WIDE_FLAG …]
-
- DESCRIPTION
- Set IAM policy for a Google Compute Engine instance.
- POSITIONAL ARGUMENTS
-
-
Instance resource - Instance resource - The instance to set the IAM policy of.
The arguments in this group can be used to specify the attributes of this
resource. The arguments in this group can be used to specify the attributes of
this resource. (NOTE) Some attributes are not given arguments in this group but
can be set in other ways. To set the [project] attribute: provide the argument
[instance] on the command line with a fully specified name; set the property
[core/project]; provide the argument [--project] on the command line. This must
be specified.
INSTANCE- ID of the instance or fully qualified identifier for the instance. This positional must be specified if any of the other arguments in this group are specified.
--zone=ZONE- The name of the Google Compute Engine zone.
POLICY_FILE-
Path to a local JSON or YAML formatted file containing a valid policy.
The output of the
get-iam-policycommand is a valid file, as is any JSON or YAML file conforming to the structure of a Policy.
-
Instance resource - Instance resource - The instance to set the IAM policy of.
The arguments in this group can be used to specify the attributes of this
resource. The arguments in this group can be used to specify the attributes of
this resource. (NOTE) Some attributes are not given arguments in this group but
can be set in other ways. To set the [project] attribute: provide the argument
[instance] on the command line with a fully specified name; set the property
[core/project]; provide the argument [--project] on the command line. This must
be specified.
- GCLOUD WIDE FLAGS
-
These flags are available to all commands: --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account,
--log-http, --project, --quiet, --trace-token, --user-output-enabled,
--verbosity. Run
$ gcloud helpfor details. - API REFERENCE
-
This command uses the
compute/v1API. The full documentation for this API can be found at: https://developers.google.com/compute/docs/reference/latest/ - EXAMPLES
-
The following command reads an IAM policy defined in a JSON file
policy.jsonand sets it for the instance 'my-instance' and zone 'ZONE':$ gcloud compute instances set-iam-policy my-instance --zone=ZONE \ policy.json See https://cloud.google.com/iam/docs/managing-policies for details of policy role and member types.
- NOTES
-
These variants are also available:
$ gcloud alpha compute instances set-iam-policy $ gcloud beta compute instances set-iam-policy
- Cloud SDK
- Product Overview
- Documentation
- gcloud CLI Overview
- Quickstarts
- All Quickstarts
- For Linux
- For Debian and Ubuntu
- For Red Hat and CentOS
- For macOS
- For Windows
- How-to Guides
- All How-to Guides
- Installing the SDK
- Setting up the SDK
- Managing SDK Components
- Scripting gcloud CLI Commands
- Enabling accessibility features
- Using gcloud Interactive Shell
- APIs & Reference
- gcloud Reference
- Overview
- gcloud access-context-manager
- gcloud ai-platform
- gcloud alpha
- Overview
- access-context-manager
- ai-platform
- app
- asset
- auth
- bigtable
- billing
- bq
- builds
- cloud-shell
- composer
- compute
- Overview
- accelerator-types
- addresses
- backend-buckets
- backend-services
- commitments
- config-ssh
- connect-to-serial-port
- copy-files
- disk-types
- disks
- external-vpn-gateways
- firewall-rules
- forwarding-rules
- health-checks
- http-health-checks
- https-health-checks
- images
- instance-groups
- Overview
- describe
- get-named-ports
- list
- list-instances
- managed
- Overview
- abandon-instances
- create
- create-instance
- delete
- delete-instances
- describe
- export-autoscaling
- get-named-ports
- instance-configs
- list
- list-instances
- recreate-instances
- resize
- rolling-action
- set-autohealing
- set-autoscaling
- set-instance-template
- set-named-ports
- set-target-pools
- stop-autoscaling
- update
- update-autoscaling
- update-instances
- wait-until
- wait-until-stable
- set-named-ports
- unmanaged
- instance-templates
- instances
- Overview
- add-access-config
- add-iam-policy-binding
- add-labels
- add-metadata
- add-resource-policies
- add-tags
- attach-disk
- create
- create-with-container
- delete
- delete-access-config
- describe
- detach-disk
- get-guest-attributes
- get-iam-policy
- get-serial-port-output
- get-shielded-identity
- import
- list
- move
- network-interfaces
- os-inventory
- remove-iam-policy-binding
- remove-labels
- remove-metadata
- remove-resource-policies
- remove-tags
- reset
- resume
- set-disk-auto-delete
- set-iam-policy
- set-machine-type
- set-min-cpu-platform
- set-scheduling
- set-scopes
- simulate-maintenance-event
- start
- stop
- suspend
- tail-serial-port-output
- update
- update-access-config
- update-container
- interconnects
- machine-images
- machine-types
- network-endpoint-groups
- networks
- operations
- os-config
- os-login
- project-info
- regions
- reservations
- reset-windows-password
- resource-policies
- routers
- routes
- scp
- security-policies
- shared-vpc
- Overview
- associated-projects
- disable
- enable
- get-host-project
- list-associated-resources
- organizations
- sign-url
- snapshots
- sole-tenancy
- ssh
- ssl-certificates
- ssl-policies
- start-iap-tunnel
- target-http-proxies
- target-https-proxies
- target-instances
- target-pools
- target-ssl-proxies
- target-tcp-proxies
- target-vpn-gateways
- tpus
- url-maps
- vpn-gateways
- vpn-tunnels
- zones
- config
- container
- Overview
- binauthz
- Overview
- attestations
- attestors
- create-signature-payload
- policy
- clusters
- get-server-config
- hub
- images
- memberships
- node-pools
- operations
- subnets
- data-catalog
- dataflow
- dataproc
- Overview
- autoscaling-policies
- clusters
- jobs
- operations
- workflow-templates
- datastore
- deployment-manager
- dialogflow
- dlp
- domains
- emulators
- endpoints
- filestore
- firebase
- firestore
- functions
- genomics
- healthcare
- Overview
- annotation-stores
- datasets
- dicom-stores
- fhir-stores
- hl7v2-stores
- operations
- help
- iam
- Overview
- list-grantable-roles
- list-testable-permissions
- policies
- roles
- service-accounts
- iap
- init
- interactive
- iot
- Overview
- devices
- registries
- kms
- Overview
- asymmetric-decrypt
- asymmetric-sign
- decrypt
- encrypt
- keyrings
- keys
- locations
- logging
- ml
- ml-engine
- monitoring
- organizations
- projects
- pubsub
- Overview
- snapshots
- subscriptions
- topics
- redis
- remote-build-execution
- resource-manager
- resources
- run
- scc
- scheduler
- search-help
- services
- source
- spanner
- Overview
- databases
- instance-configs
- instances
- operations
- rows
- sql
- survey
- tasks
- web-security-scanner
- gcloud app
- gcloud asset
- gcloud auth
- gcloud beta
- Overview
- access-context-manager
- ai-platform
- app
- Overview
- browse
- create
- deploy
- describe
- domain-mappings
- firewall-rules
- gen-config
- instances
- logs
- migrate-config
- open-console
- operations
- regions
- repair
- services
- ssl-certificates
- update
- versions
- asset
- auth
- bigtable
- billing
- builds
- composer
- compute
- Overview
- accelerator-types
- addresses
- backend-buckets
- backend-services
- commitments
- config-ssh
- connect-to-serial-port
- copy-files
- disk-types
- disks
- external-vpn-gateways
- firewall-rules
- forwarding-rules
- health-checks
- http-health-checks
- https-health-checks
- images
- instance-groups
- Overview
- describe
- get-named-ports
- list
- list-instances
- managed
- set-named-ports
- unmanaged
- instance-templates
- instances
- Overview
- add-access-config
- add-iam-policy-binding
- add-labels
- add-metadata
- add-tags
- attach-disk
- create
- create-with-container
- delete
- delete-access-config
- describe
- detach-disk
- get-guest-attributes
- get-iam-policy
- get-serial-port-output
- get-shielded-identity
- list
- move
- network-interfaces
- os-inventory
- remove-iam-policy-binding
- remove-labels
- remove-metadata
- remove-tags
- reset
- set-disk-auto-delete
- set-iam-policy
- set-machine-type
- set-scheduling
- set-scopes
- simulate-maintenance-event
- start
- stop
- tail-serial-port-output
- update
- update-access-config
- update-container
- interconnects
- machine-types
- network-endpoint-groups
- networks
- operations
- os-login
- project-info
- regions
- reservations
- reset-windows-password
- resource-policies
- routers
- routes
- scp
- security-policies
- shared-vpc
- Overview
- associated-projects
- disable
- enable
- get-host-project
- list-associated-resources
- organizations
- sign-url
- snapshots
- sole-tenancy
- ssh
- ssl-certificates
- ssl-policies
- start-iap-tunnel
- target-http-proxies
- target-https-proxies
- target-instances
- target-pools
- target-ssl-proxies
- target-tcp-proxies
- target-vpn-gateways
- tpus
- url-maps
- vpn-gateways
- vpn-tunnels
- zones
- config
- container
- Overview
- binauthz
- Overview
- attestations
- attestors
- create-signature-payload
- policy
- clusters
- get-server-config
- images
- node-pools
- operations
- subnets
- data-catalog
- dataflow
- dataproc
- Overview
- autoscaling-policies
- clusters
- jobs
- operations
- workflow-templates
- datastore
- debug
- deployment-manager
- dns
- Overview
- dns-keys
- managed-zones
- operations
- policies
- project-info
- record-sets
- domains
- emulators
- endpoints
- error-reporting
- filestore
- firebase
- firestore
- functions
- help
- iam
- init
- interactive
- iot
- Overview
- devices
- registries
- kms
- logging
- ml
- ml-engine
- organizations
- projects
- pubsub
- Overview
- snapshots
- subscriptions
- topics
- redis
- resource-manager
- run
- runtime-config
- scheduler
- services
- source
- spanner
- Overview
- databases
- instance-configs
- instances
- operations
- rows
- sql
- tasks
- gcloud bigtable
- gcloud builds
- gcloud components
- gcloud composer
- gcloud compute
- Overview
- accelerator-types
- addresses
- backend-buckets
- backend-services
- commitments
- config-ssh
- connect-to-serial-port
- copy-files
- disk-types
- disks
- firewall-rules
- forwarding-rules
- health-checks
- http-health-checks
- https-health-checks
- images
- instance-groups
- Overview
- describe
- get-named-ports
- list
- list-instances
- managed
- set-named-ports
- unmanaged
- instance-templates
- instances
- Overview
- add-access-config
- add-iam-policy-binding
- add-labels
- add-metadata
- add-tags
- attach-disk
- create
- create-with-container
- delete
- delete-access-config
- describe
- detach-disk
- get-iam-policy
- get-serial-port-output
- get-shielded-identity
- list
- move
- network-interfaces
- remove-iam-policy-binding
- remove-labels
- remove-metadata
- remove-tags
- reset
- set-disk-auto-delete
- set-iam-policy
- set-machine-type
- set-scheduling
- set-service-account
- simulate-maintenance-event
- start
- stop
- tail-serial-port-output
- update
- update-access-config
- update-container
- interconnects
- machine-types
- network-endpoint-groups
- networks
- operations
- os-login
- project-info
- regions
- reset-windows-password
- routers
- routes
- scp
- security-policies
- shared-vpc
- Overview
- associated-projects
- disable
- enable
- get-host-project
- list-associated-resources
- organizations
- sign-url
- snapshots
- sole-tenancy
- ssh
- ssl-certificates
- ssl-policies
- target-http-proxies
- target-https-proxies
- target-instances
- target-pools
- target-ssl-proxies
- target-tcp-proxies
- target-vpn-gateways
- tpus
- url-maps
- vpn-tunnels
- zones
- gcloud config
- gcloud container
- gcloud dataflow
- gcloud dataproc
- Overview
- clusters
- jobs
- operations
- workflow-templates
- gcloud datastore
- gcloud debug
- gcloud deployment-manager
- gcloud dns
- gcloud docker
- gcloud domains
- gcloud endpoints
- gcloud feedback
- gcloud filestore
- gcloud firebase
- gcloud functions
- gcloud help
- gcloud iam
- gcloud info
- gcloud init
- gcloud iot
- Overview
- devices
- registries
- gcloud kms
- gcloud logging
- gcloud ml
- Overview
- language
- speech
- video
- vision
- gcloud ml-engine
- gcloud organizations
- gcloud projects
- gcloud pubsub
- gcloud redis
- gcloud resource-manager
- gcloud scheduler
- gcloud services
- gcloud source
- gcloud spanner
- Overview
- databases
- instance-configs
- instances
- operations
- rows
- gcloud sql
- gcloud tasks
- gcloud topic
- gcloud version
- Google Cloud Client Libraries
- Resources
- All Resources
- Release Notes
- Usage Statistics
- Support
- Getting Support


