Google Cloud Kebijakan Organisasi memberi Anda kontrol terpusat dan terprogram atas resource organisasi. Sebagai administrator kebijakan organisasi, Anda dapat menentukan kebijakan organisasi, yang merupakan serangkaian batasan yang disebut batasan yang berlaku untuk Google Cloud resource dan turunan dari resource tersebut dalam hierarki resource.Google Cloud Anda dapat menerapkan kebijakan organisasi di level organisasi, folder, atau project.
Kebijakan Organisasi menyediakan batasan yang telah ditetapkan untuk berbagai layananGoogle Cloud . Namun, jika menginginkan kontrol yang lebih terperinci dan dapat disesuaikan atas kolom tertentu yang dibatasi dalam kebijakan organisasi, Anda juga dapat membuat batasan kustom dan menggunakan batasan kustom tersebut dalam kebijakan organisasi kustom.
Komponen load balancing berikut mendukung batasan kustom:
- Bucket backend
- Layanan backend
- Aturan penerusan
- Health check
- Grup endpoint jaringan
- Kebijakan load balancing layanan
- Kebijakan SSL
- Target instance
- Target pool
- Proxy target
- Peta URL
Batasan kustom juga didukung oleh resource Compute Engine seperti grup instance, dan resource VPC seperti jaringan dan subnet VPC.
Manfaat
- Pengelolaan biaya: gunakan kebijakan organisasi kustom untuk membatasi frekuensi pemeriksaan kondisi.
Keamanan, kepatuhan, dan tata kelola: Anda dapat menggunakan kebijakan organisasi kustom untuk menerapkan kebijakan. Contoh:
- Untuk menerapkan penggunaan protokol health check atau rentang port tertentu
- Untuk melarang protokol traffic backend tertentu
- Untuk mewajibkan bucket backend mengaktifkan Cloud CDN
- Untuk mewajibkan aturan penerusan menggunakan Network Service Tiers tertentu
Resource yang didukung Cloud Load Balancing
Untuk Cloud Load Balancing, Anda dapat menetapkan batasan khusus pada resource dan kolom berikut.
Bucket backend
Bucket backend: compute.googleapis.com/BackendBucket
resource.nameresource.descriptionresource.bucketNameresource.enableCdnresource.cdnPolicyresource.cdnPolicy.bypassCacheOnRequestHeadersresource.cdnPolicy.bypassCacheOnRequestHeaders.headerName
resource.cdnPolicy.cacheKeyPolicyresource.cdnPolicy.cacheKeyPolicy.includeHttpHeadersresource.cdnPolicy.cacheKeyPolicy.queryStringWhitelistresource.cdnPolicy.signedUrlCacheMaxAgeSec
resource.compressionModeresource.customResponseHeaders
Layanan backend
Layanan backend: compute.googleapis.com/BackendService
resource.nameresource.descriptionresource.portresource.portNameresource.protocolresource.backendsresource.backends.balancingModeresource.backends.capacityScalerresource.backends.descriptionresource.backends.failoverresource.backends.maxConnectionsresource.backends.maxConnectionsPerEndpointresource.backends.maxConnectionsPerInstanceresource.backends.maxRateresource.backends.maxRatePerEndpointresource.backends.maxRatePerInstanceresource.backends.maxUtilizationresource.backends.preference
resource.enableCDNresource.cdnPolicyresource.cdnPolicy.bypassCacheOnRequestHeadersresource.cdnPolicy.bypassCacheOnRequestHeaders.headerName
resource.cdnPolicy.cacheKeyPolicyresource.cdnPolicy.cacheKeyPolicy.includeHostresource.cdnPolicy.cacheKeyPolicy.includeHttpHeadersresource.cdnPolicy.cacheKeyPolicy.includeNamedCookiesresource.cdnPolicy.cacheKeyPolicy.includeProtocolresource.cdnPolicy.cacheKeyPolicy.includeQueryStringresource.cdnPolicy.cacheKeyPolicy.queryStringBlacklistresource.cdnPolicy.cacheKeyPolicy.queryStringWhitelist
resource.cdnPolicy.cacheModeresource.cdnPolicy.clientTtlresource.cdnPolicy.defaultTtlresource.cdnPolicy.maxTtlresource.cdnPolicy.negativeCachingresource.cdnPolicy.negativeCachingPolicyresource.cdnPolicy.negativeCachingPolicy.coderesource.cdnPolicy.negativeCachingPolicy.ttl
resource.cdnPolicy.requestCoalescingresource.cdnPolicy.serveWhileStaleresource.cdnPolicy.signedUrlCacheMaxAgeSec
resource.circuitBreakersresource.circuitBreakers.maxConnectionsresource.circuitBreakers.maxPendingRequestsresource.circuitBreakers.maxRequestsresource.circuitBreakers.maxRequestsPerConnectionresource.circuitBreakers.maxRetries
resource.compressionModeresource.connectionDrainingresource.connectionDraining.drainingTimeoutSec
resource.connectionTrackingPolicyresource.connectionTrackingPolicy.connectionPersistenceOnUnhealthyBackendsresource.connectionTrackingPolicy.enableStrongAffinityresource.connectionTrackingPolicy.idleTimeoutSecresource.connectionTrackingPolicy.trackingMode
resource.consistentHashresource.consistentHash.httpCookieresource.consistentHash.httpCookie.nameresource.consistentHash.httpCookie.pathresource.consistentHash.httpCookie.ttlresource.consistentHash.httpCookie.ttl.nanosresource.consistentHash.httpCookie.ttl.seconds
resource.consistentHash.minimumRingSize
resource.customRequestHeadersresource.customResponseHeadersresource.affinityCookieTtlSecresource.failoverPolicyresource.failoverPolicy.disableConnectionDrainOnFailoverresource.failoverPolicy.dropTrafficIfUnhealthyresource.failoverPolicy.failoverRatio
resource.iapresource.iap.enabledresource.iap.oauth2ClientId
resource.ipAddressSelectionPolicyresource.loadBalancingSchemeresource.localityLbPoliciesresource.localityLbPolicies.customPolicyresource.localityLbPolicies.customPolicy.dataresource.localityLbPolicies.customPolicy.nameresource.localityLbPolicies.policyresource.localityLbPolicies.policy.name
resource.logConfigresource.logConfig.enableresource.logConfig.optionalFieldsresource.logConfig.optionalModeresource.logConfig.sampleRate
resource.maxStreamDurationresource.maxStreamDuration.nanosresource.maxStreamDuration.seconds
resource.outlierDetectionresource.outlierDetection.baseEjectionTimeresource.outlierDetection.baseEjectionTime.nanosresource.outlierDetection.baseEjectionTime.secondsresource.outlierDetection.consecutiveGatewayFailureresource.outlierDetection.enforcingConsecutiveErrorsresource.outlierDetection.enforcingConsecutiveGatewayFailureresource.outlierDetection.enforcingSuccessRateresource.outlierDetection.maxEjectionPercentresource.outlierDetection.successRateMinimumHostsresource.outlierDetection.successRateRequestVolumeresource.outlierDetection.successRateStdevFactor
resource.securitySettingsresource.securitySettings.awsV4Authenticationresource.securitySettings.awsV4Authentication.accessKeyIdresource.securitySettings.awsV4Authentication.accessKeyVersionresource.securitySettings.subjectAltNames
resource.sessionAffinityresource.subsettingresource.subsetting.policy
resource.timeoutSecresource.strongSessionAffinityCookieresource.strongSessionAffinityCookie.nameresource.strongSessionAffinityCookie.pathresource.strongSessionAffinityCookie.ttlresource.strongSessionAffinityCookie.ttl.nanosresource.strongSessionAffinityCookie.ttl.seconds
Aturan penerusan
Aturan penerusan: compute.googleapis.com/ForwardingRule
resource.nameresource.descriptionresource.allowGlobalAccessresource.allowPscGlobalAccessresource.allPortsresource.IPProtocolresource.ipVersionresource.isMirroringCollectorresource.loadBalancingSchemeresource.metadataFiltersresource.metadataFilters.filterLabelsresource.metadataFilters.filterLabels.nameresource.metadataFilters.filterLabels.valueresource.metadataFilters.filterMatchCriteria
resource.networkTierresource.noAutomateDnsZoneresource.portRangeresource.portsresource.serviceDirectoryRegistrationsresource.serviceDirectoryRegistrations.namespaceresource.serviceDirectoryRegistrations.serviceresource.serviceDirectoryRegistrations.serviceDirectoryRegion
resource.serviceLabelresource.sourceIpRanges
Health check
Pemeriksaan kesehatan: compute.googleapis.com/HealthCheck
resource.nameresource.descriptionresource.checkIntervalSecresource.timeoutSecresource.unhealthyThresholdresource.healthyThresholdresource.type- Pemeriksaan kondisi TCP:
resource.tcpHealthCheck.portresource.tcpHealthCheck.requestresource.tcpHealthCheck.responseresource.tcpHealthCheck.proxyHeaderresource.tcpHealthCheck.portSpecification
- Pemeriksaan kondisi SSL:
resource.sslHealthCheck.portresource.sslHealthCheck.requestresource.sslHealthCheck.responseresource.sslHealthCheck.proxyHeaderresource.sslHealthCheck.portSpecification
- Health check HTTP:
resource.httpHealthCheck.portresource.httpHealthCheck.hostresource.httpHealthCheck.requestPathresource.httpHealthCheck.proxyHeaderresource.httpHealthCheck.responseresource.httpHealthCheck.portSpecification
- Health check HTTPS:
resource.httpsHealthCheck.portresource.httpsHealthCheck.hostresource.httpsHealthCheck.requestPathresource.httpsHealthCheck.proxyHeaderresource.httpsHealthCheck.responseresource.httpsHealthCheck.portSpecification
- Pemeriksaan kondisi HTTP/2:
resource.http2HealthCheck.portresource.http2HealthCheck.hostresource.http2HealthCheck.requestPathresource.http2HealthCheck.proxyHeaderresource.http2HealthCheck.responseresource.http2HealthCheck.portSpecification
- Health check gRPC:
resource.grpcHealthCheck.portresource.grpcHealthCheck.grpcServiceNameresource.grpcHealthCheck.portSpecification
resource.sourceRegionsresource.logConfigresource.logConfig.enable
Network endpoint groups
Grup endpoint jaringan: compute.googleapis.com/NetworkEndpointGroup
resource.annotationsresource.appEngine.serviceresource.appEngine.urlMaskresource.appEngine.versionresource.cloudFunction.functionresource.cloudFunction.urlMaskresource.cloudRun.serviceresource.cloudRun.tagresource.cloudRun.urlMaskresource.defaultPortresource.descriptionresource.nameresource.networkresource.networkEndpointTyperesource.pscData.producerPortresource.pscTargetServiceresource.subnetwork
Kebijakan load balancing layanan
Kebijakan load balancing layanan: networkservices.googleapis.com/ServiceLbPolicy
resource.autoCapacityDrain.enableresource.descriptionresource.failoverConfig.failoverHealthThresholdresource.loadBalancingAlgorithmresource.name
Kebijakan SSL
Kebijakan SSL: compute.googleapis.com/SslPolicy
resource.profileresource.nameresource.descriptionresource.minTlsVersionresource.customFeatures
Instance Target
Instance target: compute.googleapis.com/TargetInstance
resource.nameresource.descriptionresource.natPolicy
Kumpulan target
Kumpulan target: compute.googleapis.com/TargetPool
resource.nameresource.descriptionresource.sessionAffinityresource.failoverRatio
Proxy target
Proxy TCP target: compute.googleapis.com/TargetTcpProxy
resource.nameresource.descriptionresource.proxyBindresource.proxyHeader
Proxy SSL target: compute.googleapis.com/TargetSslProxy
resource.nameresource.descriptionresource.proxyHeader
Proxy HTTP target: compute.googleapis.com/TargetHttpProxy
resource.nameresource.descriptionresource.proxyBindresource.httpKeepAliveTimeoutSec
Proxy HTTPS target: compute.googleapis.com/TargetHttpsProxy
resource.nameresource.descriptionresource.proxyBindresource.httpKeepAliveTimeoutSecresource.quicOverrideresource.tlsEarlyData
Proxy gRPC target: compute.googleapis.com/TargetGrpcProxy
resource.nameresource.descriptionresource.validateForProxyless
Peta URL
Peta URL: compute.googleapis.com/UrlMap
resource.nameresource.descriptionresource.defaultCustomErrorResponsePolicyresource.defaultCustomErrorResponsePolicy.errorResponseRulesresource.defaultCustomErrorResponsePolicy.errorResponseRules.matchResponseCodesresource.defaultCustomErrorResponsePolicy.errorResponseRules.overrideResponseCoderesource.defaultCustomErrorResponsePolicy.errorResponseRules.path
resource.defaultRouteActionresource.defaultRouteAction.corsPolicyresource.defaultRouteAction.corsPolicy.allowCredentialsresource.defaultRouteAction.corsPolicy.allowHeadersresource.defaultRouteAction.corsPolicy.allowMethodsresource.defaultRouteAction.corsPolicy.allowOriginsresource.defaultRouteAction.corsPolicy.allowOriginRegexesresource.defaultRouteAction.corsPolicy.disabledresource.defaultRouteAction.corsPolicy.exposeHeadersresource.defaultRouteAction.corsPolicy.maxAgeresource.defaultRouteAction.faultInjectionPolicyresource.defaultRouteAction.faultInjectionPolicy.abortresource.defaultRouteAction.faultInjectionPolicy.abort.httpStatusresource.defaultRouteAction.faultInjectionPolicy.abort.percentage
resource.defaultRouteAction.faultInjectionPolicy.delayresource.defaultRouteAction.faultInjectionPolicy.delay.percentageresource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelayresource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.nanosresource.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.defaultRouteAction.maxStreamDurationresource.defaultRouteAction.maxStreamDuration.nanosresource.defaultRouteAction.maxStreamDuration.secondsresource.defaultRouteAction.requestMirrorPolicyresource.defaultRouteAction.retryPolicyresource.defaultRouteAction.retryPolicy.numRetriesresource.defaultRouteAction.retryPolicy.perTryTimeoutresource.defaultRouteAction.retryPolicy.perTryTimeout.nanosresource.defaultRouteAction.retryPolicy.perTryTimeout.seconds
resource.defaultRouteAction.retryPolicy.retryConditionsresource.defaultRouteAction.timeoutresource.defaultRouteAction.timeout.nanosresource.defaultRouteAction.timeout.secondsresource.defaultRouteAction.urlRewriteresource.defaultRouteAction.urlRewrite.hostRewriteresource.defaultRouteAction.urlRewrite.pathPrefixRewriteresource.defaultRouteAction.urlRewrite.pathTemplateRewriteresource.defaultRouteAction.weightedBackendServicesresource.defaultRouteAction.weightedBackendServices.headerActionresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAddresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerNameresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValueresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.replaceresource.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToRemoveresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAddresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerNameresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValueresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.replaceresource.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.defaultRouteAction.weightedBackendServices.weight
resource.defaultUrlRedirectresource.defaultUrlRedirect.hostRedirectresource.defaultUrlRedirect.httpsRedirectresource.defaultUrlRedirect.pathRedirectresource.defaultUrlRedirect.prefixRedirectresource.defaultUrlRedirect.redirectResponseCoderesource.defaultUrlRedirect.stripQuery
resource.headerActionresource.headerAction.requestHeadersToAddresource.headerAction.requestHeadersToAdd.headerNameresource.headerAction.requestHeadersToAdd.headerValueresource.headerAction.requestHeadersToAdd.replaceresource.headerAction.requestHeadersToRemoveresource.headerAction.responseHeadersToAddresource.headerAction.responseHeadersToAdd.headerNameresource.headerAction.responseHeadersToAdd.headerValueresource.headerAction.responseHeadersToAdd.replaceresource.headerAction.responseHeadersToRemove
resource.hostRulesresource.hostRules.descriptionresource.hostRules.hostsresource.hostRules.pathMatcher
resource.pathMatchersresource.pathMatchers.nameresource.pathMatchers.descriptionresource.pathMatchers.defaultCustomErrorResponsePolicyresource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRulesresource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.matchResponseCodesresource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.overrideResponseCoderesource.pathMatchers.defaultCustomErrorResponsePolicy.errorResponseRules.path
resource.pathMatchers.defaultRouteActionresource.pathMatchers.defaultRouteAction.corsPolicyresource.pathMatchers.defaultRouteAction.corsPolicy.allowCredentialsresource.pathMatchers.defaultRouteAction.corsPolicy.allowHeadersresource.pathMatchers.defaultRouteAction.corsPolicy.allowMethodsresource.pathMatchers.defaultRouteAction.corsPolicy.allowOriginsresource.pathMatchers.defaultRouteAction.corsPolicy.allowOriginRegexesresource.pathMatchers.defaultRouteAction.corsPolicy.disabledresource.pathMatchers.defaultRouteAction.corsPolicy.exposeHeadersresource.pathMatchers.defaultRouteAction.corsPolicy.maxAge
resource.pathMatchers.defaultRouteAction.faultInjectionPolicyresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abortresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abort.httpStatusresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.abort.percentageresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delayresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.percentageresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelayresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.nanosresource.pathMatchers.defaultRouteAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.pathMatchers.defaultRouteAction.maxStreamDurationresource.pathMatchers.defaultRouteAction.maxStreamDuration.nanosresource.pathMatchers.defaultRouteAction.maxStreamDuration.seconds
resource.pathMatchers.defaultRouteAction.requestMirrorPolicyresource.pathMatchers.defaultRouteAction.retryPolicyresource.pathMatchers.defaultRouteAction.retryPolicy.numRetriesresource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeoutresource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeout.nanosresource.pathMatchers.defaultRouteAction.retryPolicy.perTryTimeout.secondsresource.pathMatchers.defaultRouteAction.retryPolicy.retryConditions
resource.pathMatchers.defaultRouteAction.timeoutresource.pathMatchers.defaultRouteAction.timeout.nanosresource.pathMatchers.defaultRouteAction.timeout.seconds
resource.pathMatchers.defaultRouteAction.urlRewriteresource.pathMatchers.defaultRouteAction.urlRewrite.hostRewriteresource.pathMatchers.defaultRouteAction.urlRewrite.pathPrefixRewriteresource.pathMatchers.defaultRouteAction.urlRewrite.pathTemplateRewrite
resource.pathMatchers.defaultRouteAction.weightedBackendServicesresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerActionresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAddresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToAdd.replace
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.requestHeadersToRemoveresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAddresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToAdd.replace
resource.pathMatchers.defaultRouteAction.weightedBackendServices.headerAction.responseHeadersToRemoveresource.pathMatchers.defaultRouteAction.weightedBackendServices.weight
resource.pathMatchers.defaultUrlRedirectresource.pathMatchers.defaultUrlRedirect.hostRedirectresource.pathMatchers.defaultUrlRedirect.httpsRedirectresource.pathMatchers.defaultUrlRedirect.pathRedirectresource.pathMatchers.defaultUrlRedirect.prefixRedirectresource.pathMatchers.defaultUrlRedirect.redirectResponseCoderesource.pathMatchers.defaultUrlRedirect.stripQueryresource.pathMatchers.headerActionresource.pathMatchers.headerAction.requestHeadersToAddresource.pathMatchers.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.headerAction.requestHeadersToAdd.replaceresource.pathMatchers.headerAction.requestHeadersToRemoveresource.pathMatchers.headerAction.responseHeadersToAddresource.pathMatchers.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.headerAction.responseHeadersToAdd.replaceresource.pathMatchers.headerAction.responseHeadersToRemoveresource.pathMatchers.pathRulesresource.pathMatchers.pathRules.pathsresource.pathMatchers.pathRules.customErrorResponsePolicyresource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRulesresource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.matchResponseCodesresource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.overrideResponseCoderesource.pathMatchers.pathRules.customErrorResponsePolicy.errorResponseRules.path
resource.pathMatchers.pathRules.routeActionresource.pathMatchers.pathRules.routeAction.corsPolicyresource.pathMatchers.pathRules.routeAction.corsPolicy.allowCredentialsresource.pathMatchers.pathRules.routeAction.corsPolicy.allowHeadersresource.pathMatchers.pathRules.routeAction.corsPolicy.allowMethodsresource.pathMatchers.pathRules.routeAction.corsPolicy.allowOriginsresource.pathMatchers.pathRules.routeAction.corsPolicy.allowOriginRegexesresource.pathMatchers.pathRules.routeAction.corsPolicy.disabledresource.pathMatchers.pathRules.routeAction.corsPolicy.exposeHeadersresource.pathMatchers.pathRules.routeAction.corsPolicy.maxAgeresource.pathMatchers.pathRules.routeAction.faultInjectionPolicyresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abortresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abort.httpStatusresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.abort.percentage
resource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delayresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.percentageresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelayresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelay.nanosresource.pathMatchers.pathRules.routeAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.pathMatchers.pathRules.routeAction.maxStreamDurationresource.pathMatchers.pathRules.routeAction.maxStreamDuration.nanosresource.pathMatchers.pathRules.routeAction.maxStreamDuration.secondsresource.pathMatchers.pathRules.routeAction.requestMirrorPolicyresource.pathMatchers.pathRules.routeAction.retryPolicyresource.pathMatchers.pathRules.routeAction.retryPolicy.numRetriesresource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeoutresource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeout.nanosresource.pathMatchers.pathRules.routeAction.retryPolicy.perTryTimeout.seconds
resource.pathMatchers.pathRules.routeAction.retryPolicy.retryConditionsresource.pathMatchers.pathRules.routeAction.timeoutresource.pathMatchers.pathRules.routeAction.timeout.nanosresource.pathMatchers.pathRules.routeAction.timeout.secondsresource.pathMatchers.pathRules.routeAction.urlRewriteresource.pathMatchers.pathRules.routeAction.urlRewrite.hostRewriteresource.pathMatchers.pathRules.routeAction.urlRewrite.pathPrefixRewriteresource.pathMatchers.pathRules.routeAction.urlRewrite.pathTemplateRewriteresource.pathMatchers.pathRules.routeAction.weightedBackendServicesresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerActionresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAddresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.replaceresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.requestHeadersToRemoveresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAddresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.replaceresource.pathMatchers.pathRules.routeAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.pathMatchers.pathRules.routeAction.weightedBackendServices.weight
resource.pathMatchers.pathRules.urlRedirectresource.pathMatchers.pathRules.urlRedirect.hostRedirectresource.pathMatchers.pathRules.urlRedirect.httpsRedirectresource.pathMatchers.pathRules.urlRedirect.pathRedirectresource.pathMatchers.pathRules.urlRedirect.prefixRedirectresource.pathMatchers.pathRules.urlRedirect.redirectResponseCoderesource.pathMatchers.pathRules.urlRedirect.stripQuery
resource.pathMatchers.routeRulesresource.pathMatchers.routeRules.descriptionresource.pathMatchers.routeRules.priorityresource.pathMatchers.routeRules.customErrorResponsePolicyresource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRulesresource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.matchResponseCodesresource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.overrideResponseCoderesource.pathMatchers.routeRules.customErrorResponsePolicy.errorResponseRules.path
resource.pathMatchers.routeRules.headerActionresource.pathMatchers.routeRules.headerAction.requestHeadersToAddresource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.routeRules.headerAction.requestHeadersToAdd.replaceresource.pathMatchers.routeRules.headerAction.requestHeadersToRemoveresource.pathMatchers.routeRules.headerAction.responseHeadersToAddresource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.routeRules.headerAction.responseHeadersToAdd.replaceresource.pathMatchers.routeRules.headerAction.responseHeadersToRemove
resource.pathMatchers.routeRules.matchRulesresource.pathMatchers.routeRules.matchRules.fullPathMatchresource.pathMatchers.routeRules.matchRules.headerMatchesresource.pathMatchers.routeRules.matchRules.headerMatches.exactMatchresource.pathMatchers.routeRules.matchRules.headerMatches.headerNameresource.pathMatchers.routeRules.matchRules.headerMatches.invertMatchresource.pathMatchers.routeRules.matchRules.headerMatches.prefixMatchresource.pathMatchers.routeRules.matchRules.headerMatches.presentMatchresource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatchresource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatch.rangeStartresource.pathMatchers.routeRules.matchRules.headerMatches.rangeMatch.rangeEnd
resource.pathMatchers.routeRules.matchRules.headerMatches.regexMatchresource.pathMatchers.routeRules.matchRules.headerMatches.suffixMatchresource.pathMatchers.routeRules.matchRules.ignoreCaseresource.pathMatchers.routeRules.matchRules.metadataFiltersresource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabelsresource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabels.nameresource.pathMatchers.routeRules.matchRules.metadataFilters.filterLabels.value
resource.pathMatchers.routeRules.matchRules.metadataFilters.filterMatchCriteriaresource.pathMatchers.routeRules.matchRules.pathTemplateMatchresource.pathMatchers.routeRules.matchRules.prefixMatchresource.pathMatchers.routeRules.matchRules.queryParameterMatchesresource.pathMatchers.routeRules.matchRules.queryParameterMatches.nameresource.pathMatchers.routeRules.matchRules.queryParameterMatches.exactMatchresource.pathMatchers.routeRules.matchRules.queryParameterMatches.presentMatchresource.pathMatchers.routeRules.matchRules.queryParameterMatches.regexMatchresource.pathMatchers.routeRules.matchRules.regexMatch
resource.pathMatchers.routeRules.routeActionresource.pathMatchers.routeRules.routeAction.corsPolicyresource.pathMatchers.routeRules.routeAction.corsPolicy.allowCredentialsresource.pathMatchers.routeRules.routeAction.corsPolicy.allowHeadersresource.pathMatchers.routeRules.routeAction.corsPolicy.allowMethodsresource.pathMatchers.routeRules.routeAction.corsPolicy.allowOriginsresource.pathMatchers.routeRules.routeAction.corsPolicy.allowOriginRegexesresource.pathMatchers.routeRules.routeAction.corsPolicy.disabledresource.pathMatchers.routeRules.routeAction.corsPolicy.exposeHeadersresource.pathMatchers.routeRules.routeAction.corsPolicy.maxAgeresource.pathMatchers.routeRules.routeAction.faultInjectionPolicyresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abortresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abort.httpStatusresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.abort.percentage
resource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delayresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.percentageresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelayresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelay.nanosresource.pathMatchers.routeRules.routeAction.faultInjectionPolicy.delay.fixedDelay.seconds
resource.pathMatchers.routeRules.routeAction.maxStreamDurationresource.pathMatchers.routeRules.routeAction.maxStreamDuration.nanosresource.pathMatchers.routeRules.routeAction.maxStreamDuration.secondsresource.pathMatchers.routeRules.routeAction.requestMirrorPolicyresource.pathMatchers.routeRules.routeAction.retryPolicyresource.pathMatchers.routeRules.routeAction.retryPolicy.numRetriesresource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeoutresource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeout.nanosresource.pathMatchers.routeRules.routeAction.retryPolicy.perTryTimeout.seconds
resource.pathMatchers.routeRules.routeAction.retryPolicy.retryConditionsresource.pathMatchers.routeRules.routeAction.timeoutresource.pathMatchers.routeRules.routeAction.timeout.nanosresource.pathMatchers.routeRules.routeAction.timeout.secondsresource.pathMatchers.routeRules.routeAction.urlRewriteresource.pathMatchers.routeRules.routeAction.urlRewrite.hostRewriteresource.pathMatchers.routeRules.routeAction.urlRewrite.pathPrefixRewriteresource.pathMatchers.routeRules.routeAction.urlRewrite.pathTemplateRewriteresource.pathMatchers.routeRules.routeAction.weightedBackendServicesresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerActionresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAddresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerNameresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.headerValueresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToAdd.replaceresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.requestHeadersToRemoveresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAddresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerNameresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.headerValueresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToAdd.replaceresource.pathMatchers.routeRules.routeAction.weightedBackendServices.headerAction.responseHeadersToRemove
resource.pathMatchers.routeRules.routeAction.weightedBackendServices.weight
resource.pathMatchers.routeRules.urlRedirectresource.pathMatchers.routeRules.urlRedirect.hostRedirectresource.pathMatchers.routeRules.urlRedirect.httpsRedirectresource.pathMatchers.routeRules.urlRedirect.pathRedirectresource.pathMatchers.routeRules.urlRedirect.prefixRedirectresource.pathMatchers.routeRules.urlRedirect.redirectResponseCoderesource.pathMatchers.routeRules.urlRedirect.stripQuery
resource.testsresource.tests.descriptionresource.tests.expectedOutputUrlresource.tests.expectedRedirectResponseCoderesource.tests.headersresource.tests.headers.nameresource.tests.headers.valueresource.tests.hostresource.tests.path
Untuk resource komputasi lain yang didukung, lihat halaman batasan kustom Compute Engine untuk mengetahui detailnya.
Pewarisan kebijakan
Secara default, kebijakan organisasi diwarisi oleh turunan resource tempat Anda menerapkan kebijakan tersebut. Misalnya, jika Anda menerapkan kebijakan pada folder, Google Cloud akan menerapkan kebijakan tersebut pada semua project di folder tersebut. Untuk mempelajari lebih lanjut perilaku ini dan cara mengubahnya, lihat Aturan evaluasi hierarki.
Sebelum memulai
-
Siapkan autentikasi, jika Anda belum melakukannya.
Autentikasi memverifikasi identitas Anda untuk mengakses Google Cloud layanan dan API. Untuk menjalankan
kode atau sampel dari lingkungan pengembangan lokal, Anda dapat melakukan autentikasi ke
Compute Engine dengan memilih salah satu opsi berikut:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
-
Menginstal Google Cloud CLI. Setelah penginstalan, lakukan inisialisasi Google Cloud CLI dengan menjalankan perintah berikut:
gcloud initJika Anda menggunakan penyedia identitas (IdP) eksternal, Anda harus login ke gcloud CLI dengan identitas gabungan Anda terlebih dahulu.
- Set a default region and zone.
- Pastikan Anda mengetahui ID organisasi Anda.
Peran yang diperlukan
Guna mendapatkan izin yang Anda perlukan untuk mengelola kebijakan organisasi untuk resource Cloud Load Balancing, minta administrator Anda untuk memberi Anda peran IAM berikut:
-
Administrator kebijakan organisasi (
roles/orgpolicy.policyAdmin) pada resource_types organisasi -
Untuk menguji batasan pada resource load balancing:
Compute Load Balancer Admin (v1) (
roles/compute.loadBalancerAdmin.v1) pada resource project
Untuk mengetahui informasi selengkapnya tentang cara memberikan peran, lihat Mengelola akses ke project, folder, dan organisasi.
Peran bawaan ini berisi izin yang diperlukan untuk mengelola kebijakan organisasi untuk resource Cloud Load Balancing. Untuk melihat izin yang benar-benar diperlukan, luaskan bagian Izin yang diperlukan:
Izin yang diperlukan
Izin berikut diperlukan guna mengelola kebijakan organisasi untuk resource Cloud Load Balancing:
-
orgpolicy.constraints.list -
orgpolicy.policies.create -
orgpolicy.policies.delete -
orgpolicy.policies.list -
orgpolicy.policies.update -
orgpolicy.policy.get -
orgpolicy.policy.set
Anda mungkin juga bisa mendapatkan izin ini dengan peran khusus atau peran bawaan lainnya.
Menyiapkan batasan kustom
Batasan kustom ditentukan oleh resource, metode, kondisi, dan tindakan yang didukung oleh layanan tempat Anda menerapkan kebijakan organisasi. Kondisi untuk batasan kustom Anda ditentukan menggunakan Common Expression Language (CEL). Untuk mengetahui informasi selengkapnya tentang cara membangun kondisi dalam batasan kustom menggunakan CEL, lihat bagian CEL tentang Membuat dan mengelola kebijakan organisasi kustom.
Anda dapat membuat batasan kustom dan menyiapkannya untuk digunakan dalam kebijakan organisasi menggunakan Google Cloud konsol atau gcloud CLI.
Konsol
Di konsol Google Cloud , buka halaman Organization policies.
Pilih pemilih project di bagian atas halaman.
Dari jendela Select a resource, pilih organisasi yang ingin Anda buatkan batasan kustomnya.
Klik Custom constraint.
Di kotak Display name, masukkan nama yang mudah dipahami manusia untuk batasan. Kolom ini memiliki panjang maksimal 200 karakter. Jangan menggunakan PII atau data sensitif dalam nama batasan, karena dapat terekspos dalam pesan error.
Di kotak Constraint ID, masukkan nama yang diinginkan untuk batasan kustom baru. Batasan kustom harus dimulai dengan
custom., dan hanya boleh menyertakan huruf besar, huruf kecil, atau angka, misalnya,custom.enforceTCPHealthCheckPort1024. Panjang maksimum kolom ini adalah 70 karakter, tidak menghitung awalan, misalnya,organizations/123456789/customConstraints/custom..Di kotak Description, masukkan deskripsi batasan yang mudah dipahami untuk ditampilkan sebagai pesan error saat kebijakan dilanggar. Kolom ini memiliki panjang maksimal 2000 karakter.
Di kotak Resource type, pilih nama resource REST Google Cloud yang berisi objek dan kolom yang ingin Anda batasi. Contohnya,
compute.googleapis.com/HealthCheck.Di bagian Enforcement method, pilih apakah akan menerapkan batasan pada metode
CREATEREST.Untuk menentukan kondisi, klik Edit condition.
Di panel Add condition, buat kondisi CEL yang mengacu pada resource layanan yang didukung, misalnya
. Kolom ini memiliki panjang maksimal 1000 karakter.resource.tcpHealthCheck.port >= 1024Klik Simpan.
Di bagian Action, pilih apakah akan mengizinkan atau menolak metode yang dievaluasi jika kondisi sebelumnya terpenuhi.
Klik Create constraint.
Setelah Anda memasukkan nilai ke setiap kolom, konfigurasi YAML yang setara untuk batasan kustom ini akan muncul di sebelah kanan.
gcloud
Untuk membuat batasan khusus menggunakan gcloud CLI, buat file YAML untuk batasan khusus:
name: organizations/ORGANIZATION_ID/customConstraints/CONSTRAINT_NAME resource_types: - compute.googleapis.com/RESOURCE_NAME method_types: - CREATE - UPDATE condition: CONDITION action_type: ACTION display_name: DISPLAY_NAME description: DESCRIPTIONGanti kode berikut:
ORGANIZATION_ID: ID organisasi Anda, seperti123456789.CONSTRAINT_NAME: nama yang Anda inginkan untuk batasan kustom baru. Batasan kustom harus diawali dengancustom., dan hanya boleh menyertakan huruf besar, huruf kecil, atau angka. Contohnya,custom.enforceTCPHealthCheckPort1024. Panjang maksimum kolom ini adalah 70 karakter, tidak menghitung awalan (misalnya,organizations/123456789/customConstraints/custom.).RESOURCE_NAME: nama (bukan URI) resource REST Compute Engine API yang berisi objek dan kolom yang ingin Anda batasi. Contoh,HealthCheck.CONDITION: kondisi CEL yang ditulis berdasarkan representasi resource layanan yang didukung. Kolom ini memiliki panjang maksimal 1000 karakter. Lihat Resource yang didukung untuk mengetahui informasi selengkapnya tentang resource yang tersedia untuk menulis kondisi. Contoh,"resource.tcpHealthCheck.port >= 1024"ACTION: tindakan yang akan diambil jikaconditionterpenuhi. Ini dapat berupaALLOWatauDENY.DISPLAY_NAME: nama yang mudah dibaca manusia untuk batasan. Kolom ini memiliki panjang maksimal 200 karakter.DESCRIPTION: deskripsi batasan yang mudah dipahami untuk ditampilkan sebagai pesan error saat kebijakan dilanggar. Kolom ini memiliki panjang maksimal 2000 karakter.
Untuk mengetahui informasi selengkapnya tentang cara membuat batasan kustom, lihat Membuat dan mengelola kebijakan organisasi kustom.
Setelah membuat file YAML untuk batasan kustom baru, Anda harus menyiapkannya agar tersedia untuk kebijakan organisasi di organisasi Anda. Untuk menyiapkan batasan kustom, gunakan perintahgcloud org-policies set-custom-constraint: Gantigcloud org-policies set-custom-constraint CONSTRAINT_PATH
CONSTRAINT_PATHdengan jalur lengkap ke file batasan kustom Anda. Contohnya,/home/user/customconstraint.yamlSetelah selesai, batasan kustom Anda tersedia sebagai kebijakan organisasi dalam daftar kebijakan organisasi. Google Cloud Untuk memverifikasi bahwa ada batasan kustom, gunakan perintahgcloud org-policies list-custom-constraints: Gantigcloud org-policies list-custom-constraints --organization=ORGANIZATION_ID
ORGANIZATION_IDdengan ID resource organisasi Anda. Untuk mengetahui informasi selengkapnya, lihat Melihat kebijakan organisasi.Menerapkan batasan khusus
Anda dapat menerapkan batasan dengan membuat kebijakan organisasi yang mereferensikannya, lalu menerapkan kebijakan organisasi tersebut ke resource Google Cloud .Konsol
- Di konsol Google Cloud , buka halaman Organization policies.
- Dari pemilih project, pilih project yang ingin Anda tetapkan kebijakan organisasinya.
- Dari daftar di halaman Organization policies, pilih batasan Anda untuk melihat halaman Policy details untuk batasan tersebut.
- Untuk mengonfigurasi kebijakan organisasi untuk resource ini, klik Manage policy.
- Di halaman Edit kebijakan, pilih Ganti kebijakan induk.
- Klik Add a rule.
- Di bagian Penerapan, pilih apakah penerapan kebijakan organisasi ini diaktifkan atau dinonaktifkan.
- Opsional: Untuk membuat kebijakan organisasi bersyarat pada tag, klik Tambahkan kondisi. Perhatikan bahwa jika menambahkan aturan kondisional ke kebijakan organisasi, Anda harus menambahkan setidaknya satu aturan tanpa syarat atau kebijakan tidak dapat disimpan. Untuk mengetahui informasi selengkapnya, lihat Menetapkan kebijakan organisasi dengan tag.
- Klik Uji perubahan untuk menyimulasikan efek kebijakan organisasi. Simulasi kebijakan tidak tersedia untuk batasan terkelola lama. Untuk mengetahui informasi selengkapnya, lihat Menguji perubahan kebijakan organisasi dengan Policy Simulator.
- Untuk menyelesaikan dan menerapkan kebijakan organisasi, klik Set policy. Kebijakan ini memerlukan waktu hingga 15 menit untuk diterapkan.
gcloud
Untuk membuat kebijakan organisasi dengan aturan boolean, buat file YAML kebijakan yang merujuk batasan:
name: projects/PROJECT_ID/policies/CONSTRAINT_NAME spec: rules: - enforce: true
Ganti kode berikut:
-
PROJECT_ID: project tempat Anda ingin menerapkan batasan. -
CONSTRAINT_NAME: nama yang Anda tentukan untuk batasan kustom. Contoh,custom.enforceTCPHealthCheckPort1024
Untuk menerapkan kebijakan organisasi yang berisi batasan, jalankan perintah berikut:
gcloud org-policies set-policy POLICY_PATH
Ganti
POLICY_PATHdengan jalur lengkap ke file YAML kebijakan organisasi Anda. Kebijakan ini memerlukan waktu hingga 15 menit untuk diterapkan.Contoh: Menggunakan batasan kustom untuk membatasi kemampuan TLS
Untuk membatasi kemampuan TLS untuk load balancer yang didukung menggunakan batasan kustom, tentukan kebijakan yang menggunakan batasan
constraints/compute.requireSslPolicyyang telah ditentukan sebelumnya di organisasi Anda. Setelah menentukan kebijakan, ikuti langkah-langkah berikut untuk menyiapkan batasan kustom dan menggunakannya.Buat file YAML untuk batasan standar.
name: organizations/ORGANIZATION_ID/customConstraints/custom.CONSTRAINT_NAME resource_types: compute.googleapis.com/SslPolicy methodTypes: - CREATE - UPDATE condition: resource.FIELD_NAME == VALUE action_type: ACTION display_name: DISPLAY_NAME description: DESCRIPTIONContoh berikut membatasi versi TLS minimum ke 1.2:
name: organizations/012345678901/customConstraints/custom.restrictLbTlsVersion resource_types: compute.googleapis.com/SslPolicy methodTypes: - CREATE - UPDATE condition: resource.minTlsVersion == "TLS_1_2" action_type: ALLOW display_name: Restrict Load Balancing TLS version to 1.2 description: Only allow SSL policies to be created or updated if the minimum TLS version is 1.2 where this custom constraint is enforced.Berikut adalah contoh lain batasan kustom yang hanya mengizinkan pembuatan resource SSL jika kondisi berikut terpenuhi:
- Versi TLS minimum ditetapkan ke 1.2.
- Kebijakan SSL memiliki profil CUSTOM yang memungkinkan Anda memilih fitur SSL satu per satu.
- Kebijakan SSL tidak menyertakan cipher suite ChaCha20-Poly1305.
name: organizations/ORGANIZATION_ID/customConstraints/custom.restrictLbTlsCapabilities resourceTypes: - compute.googleapis.com/SslPolicy methodTypes: - CREATE - UPDATE condition: resource.minTlsVersion == "TLS_1_2" && resource.profile == "CUSTOM" && !resource.customFeatures.exists(feature, feature.contains("CHACHA20_POLY1305")) actionType: ALLOW displayName: Restrict Load Balancing TLS Capabilities description: Only allow SSL Policy resources to be created or updated if the minimum TLS version is 1.2, profile is CUSTOM, and no ChaCha20-Poly1305 cipher suite is used where this custom constraint is enforced.Tambahkan batasan kustom ke organisasi Anda.
gcloud org-policies set-custom-constraint PATH_TO_FILE
Pastikan batasan kustom ada di organisasi Anda.
gcloud org-policies list-custom-constraints \ --organization=ORGANIZATION_IDBuat file kebijakan untuk batasan.
name: projects/PROJECT_ID/policies/custom.CONSTRAINT_NAME spec: rules: – enforce: true
Ganti kode berikut:
PROJECT_ID: Google Cloud project ID AndaCONSTRAINT_NAME: nama batasan
Terapkan kebijakan.
gcloud org-policies set-policy PATH_TO_POLICY_FILE
Ganti
PATH_TO_POLICY_FILEdengan jalur yang sepenuhnya memenuhi syarat ke file kebijakan Anda.Dengan asumsi Anda telah membuat file YAML untuk membatasi versi TLS minimum ke 1.2, uji batasan dengan membuat kebijakan SSL dengan
minTlsVersionditetapkan keTLS_1_0:gcloud compute ssl-policies create SSL_POLICY_NAME \ --min-tls-version=1.0 \ --project=PROJECT_IDOutputnya mirip dengan hal berikut ini:
ERROR: (gcloud.compute.ssl-policies.update) HTTPError 412: Operation denied by custom org policy: [customConstraints/custom. restrictLbTlsVersion] : Only allow SSL policy resources to be created or updated if the minimum TLS version is 1.2 where this custom constraint is enforced.
Contoh: Membuat batasan yang membatasi port health check TCP ke minimum 1024
Contoh berikut membuat batasan dan kebijakan kustom yang membatasi nomor port health check TCP ke minimum
1024.Sebelum memulai, Anda perlu mengetahui hal-hal berikut:
- ID organisasi Anda
Project ID
gcloud
Buat file batasan
enforceTCPHealthCheckPort1024.yamldengan informasi berikut:name: organizations/ORGANIZATION_ID/customConstraints/custom.enforceTCPHealthCheckPort1024 resource_types: – compute.googleapis.com/HealthCheck condition: "resource.tcpHealthCheck.port >= 1024" method_types: – CREATE – UPDATE action_type: ALLOW display_name: Only TCP HealthCheck Port >= 1024 Allowed. description: Prevent TCP health checks on well-known ports.
Menetapkan batasan kustom.
gcloud org-policies set-custom-constraint enforceTCPHealthCheckPort1024.yaml
Buat file kebijakan
enforceTCPHealthCheckPort1024-policy.yamldengan informasi berikut. Dalam contoh ini, kami menerapkan batasan ini di level project, tetapi Anda juga dapat menetapkannya di level organisasi atau folder. GantiPROJECT_IDdengan project ID Anda.name: projects/PROJECT_ID/policies/custom.enforceTCPHealthCheckPort1024 spec: rules: – enforce: true
Terapkan kebijakan.
gcloud org-policies set-policy enforceTCPHealthCheckPort1024-policy.yaml
Uji batasan dengan mencoba membuat health check TCP di port 80, yang tidak diizinkan.
gcloud compute health-checks create tcp my-tcp-health-check \ --project=PROJECT_ID \ --region=us-central1 \ --port=80 \ --check-interval=5s \ --timeout=5s \ --healthy-threshold=4 \ --unhealthy-threshold=5 \Outputnya mirip dengan hal berikut ini:
ERROR: (gcloud.compute.healthChecks.create) Could not fetch resource: – Operation denied by custom org policies: [customConstraints/
custom.enforceTCPHealthCheckPort1024]: Only TCP HealthCheck Port >= 1024 Allowed.
Contoh lainnya untuk kasus penggunaan umum
Bagian berikut memberikan sintaksis beberapa batasan khusus yang mungkin berguna bagi Anda:
Bucket backend
Kasus penggunaan Sintaks Mewajibkan semua bucket backend mengaktifkan Cloud CDN name: organizations/ORGANIZATION_ID/customConstraints/custom.backendBucketEnableCdn resourceTypes: - compute.googleapis.com/BackendBucket methodTypes: - CREATE - UPDATE condition: "resource.enableCdn == true" actionType: ALLOW displayName: Require all backend buckets to have Cloud CDN enabled description: All backend buckets must have Cloud CDN enabled.
Layanan backend
Kasus penggunaan Sintaks Melarang penggunaan HTTP dan TCP sebagai protokol layanan backend name: organizations/ORGANIZATION_ID/customConstraints/custom.backendBucketEnableCdn resourceTypes: - compute.googleapis.com/BackendService methodTypes: - CREATE - UPDATE condition: "resource.serviceProtocol == 'HTTP' || resource.serviceProtocol == 'TCP'" actionType: DENY displayName: Disallow the use of HTTP and TCP as backend service protocols description: Backend services cannot configure HTTP or TCP as the backend service protocol.
Aturan penerusan
Kasus penggunaan Sintaks Mengharuskan aturan penerusan menggunakan Paket Standar name: organizations/ORGANIZATION_ID/customConstraints/custom.forwardingRulesStandardTier resourceTypes: - compute.googleapis.com/ForwardingRule methodTypes: - CREATE - UPDATE condition: "resource.networkTier == 'STANDARD'" actionType: ALLOW displayName: Require forwarding rules to use Standard Tier description: Forwarding rules must use the Standard Network Service Tier.
Health check
Kasus penggunaan Sintaks Mewajibkan semua protokol health check terjadi di port 1024 atau yang lebih tinggi name: organizations/ORGANIZATION_ID/customConstraints/custom.healthCheckPortMin1024 resourceTypes: - compute.googleapis.com/HealthCheck methodTypes: - CREATE - UPDATE condition: "resource.tcpHealthCheck.port >= 1024 && resource.httpHealthCheck.port >= 1024 && resource.httpsHealthCheck.port >= 1024 && resource.sslHealthCheck.port >= 1024 && resource.sslHealthCheck.port >= 1024 &&resource.http2HealthCheck.port >= 1024 && resource.grpcHealthCheck.port >= 1024" actionType: ALLOW displayName: Require port 1024 or greater for all health checks description: All health check protocols must use a port of 1024 or higher, to avoid well-known ports.
Tidak mengizinkan health check GRPC name: organizations/ORGANIZATION_ID/customConstraints/custom.disallowGRPCHealthChecks resourceTypes: - compute.googleapis.com/HealthCheck methodTypes: - CREATE - UPDATE condition: "resource.type == 'GRPC'" actionType: DENY displayName: Disallow GRPC health checks description: Health checks aren't allowed to use GRPC.
Mencegah pemeriksaan health check dengan frekuensi tinggi name: organizations/ORGANIZATION_ID/customConstraints/custom.minHealthCheckFrequency resourceTypes: - compute.googleapis.com/HealthCheck methodTypes: - CREATE - UPDATE condition: "resource.checkIntervalSec >= 30" actionType: ALLOW displayName: Disallow fast health check probes description: Prevent health checks from having a probe frequency under 30 seconds.
Proxy target
Kasus penggunaan Sintaks Jangan izinkan nilai waktu tunggu keep-alive HTTPS klien yang lebih besar dari 1.000 detik name: organizations/ORGANIZATION_ID/customConstraints/custom.clientHTTPSKeepalive1000Sec resourceTypes: - compute.googleapis.com/TargetHttpsProxy methodTypes: - CREATE - UPDATE condition: "resource.httpKeepAliveTimeoutSec > 1000" actionType: DENY displayName: Disallow client HTTPS keepalive timeout greater than 1000 seconds description: Disallow client HTTPS keepalive timeout values greater than 1000 seconds.
Peta URL
Kasus penggunaan Sintaks Mewajibkan peta URL memiliki kebijakan respons error kustom untuk kode status HTTP 500name: organizations/ORGANIZATION_ID/customConstraints/custom.urlMapCustomResponseHTTP500 resourceTypes: - compute.googleapis.com/UrlMaps methodTypes: - CREATE - UPDATE condition: "resource.defaultCustomErrorResponsePolicy.errorResponseRule.exists(value, value.matchResponseCode == 500)" actionType: ALLOW displayName: Require URL maps to have a custom error response policy for HTTP 500 errors description: URL maps must have a custom error response policy configured for HTTP 500 errors.
Instance Target
Kasus penggunaan Sintaks Mewajibkan instance target memiliki nama yang diawali dengan string "targetInstance" name: organizations/ORGANIZATION_ID/customConstraints/custom.targetInstanceConstraint resourceTypes: - compute.googleapis.com/TargetInstance methodTypes: - CREATE - UPDATE condition: "resource.name.startsWith('targetInstance')" actionType: ALLOW displayName: Require target instances to have a name that starts with the string "targetInstance" description: Target instances must have resource names that start with the string "targetInstance"
Kumpulan target
Kasus penggunaan Sintaks Mengharuskan kumpulan target memiliki afinitas sesi CLIENT_IP name: organizations/ORGANIZATION_ID/customConstraints/custom.targetPoolConstraint resourceTypes: - compute.googleapis.com/TargetPool methodTypes: - CREATE - UPDATE condition: "resource.sessionAffinity == 'CLIENT_IP'" actionType: ALLOW displayName: Require target pools to use CLIENT_IP session affinity description: Target pools must use CLIENT_IP session affinity
Batasan
Pemeriksaan kesehatan lama (Global lama (HTTP) dan Global lama (HTTPS)) tidak didukung.
Untuk beberapa resource Compute Engine, seperti resource kebijakan SSL Compute Engine, batasan kustom juga diterapkan pada metode
UPDATE.
Langkah berikutnya
- Pelajari kebijakan organisasi lebih lanjut.
- Pelajari lebih lanjut cara membuat dan mengelola kebijakan organisasi.
- Lihat daftar lengkap Batasan kebijakan organisasi yang telah ditentukan.
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-10-19 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-10-19 UTC."],[],[]] -