View a markdown version of this page

在 Amazon CLI 中使用端点 - Amazon Command Line Interface
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)。

在 Amazon CLI 中使用端点

要通过编程方式连接到某个 Amazon Web Services 服务,您需要使用端点。端点是作为 Amazon Web 服务的入口点的 URL。Amazon Command Line Interface (Amazon CLI) 会自动为 Amazon Web Services 区域中的每项服务使用默认端点,但您可以应 API 请求指定备用端点。

为单个命令设置端点

要覆盖单个命令的任何端点设置或环境变量,请使用 --endpoint-url 命令行选项。以下命令示例使用自定义 Amazon S3 端点 URL。

$ aws s3 ls --endpoint-url http://localhost:4567

为所有 Amazon Web Services 服务设置全局端点

要将所有服务的请求路由到自定义端点 URL,请使用以下设置之一:

  • 环境变量:

    • AWS_IGNORE_CONFIGURED_ENDPOINT_URLS – 忽略已配置的端点 URL。

      Linux or macOS
      $ export AWS_IGNORE_CONFIGURED_ENDPOINT_URLS=true
      Windows Command Prompt

      为所有会话设置

      C:\> setx AWS_IGNORE_CONFIGURED_ENDPOINT_URLS true

      仅为当前会话设置

      C:\> set AWS_IGNORE_CONFIGURED_ENDPOINT_URLS=true
      PowerShell
      PS C:\> $Env:AWS_IGNORE_CONFIGURED_ENDPOINT_URLS="true"
    • AWS_ENDPOINT_URL – 设置全局端点 URL。

      Linux or macOS
      $ export AWS_ENDPOINT_URL=http://localhost:4567
      Windows Command Prompt

      为所有会话设置

      C:\> setx AWS_ENDPOINT_URL http://localhost:4567

      仅为当前会话设置

      C:\> set AWS_ENDPOINT_URL=http://localhost:4567
      PowerShell
      PS C:\> $Env:AWS_ENDPOINT_URL="http://localhost:4567"
  • config 文件:

特定于服务的端点和 --endpoint-url 命令行选项会覆盖所有全局端点。

设置成为所有 Amazon Web Services 服务使用 FIPS 端点

要路由所有服务的请求以使用 FIPS 端点,请使用以下设置之一:

  • AWS_USE_FIPS_ENDPOINT 环境变量。

    Linux or macOS
    $ export AWS_USE_FIPS_ENDPOINT=true
    Windows Command Prompt

    为所有会话设置

    C:\> setx AWS_USE_FIPS_ENDPOINT true

    仅为当前会话设置

    C:\> set AWS_USE_FIPS_ENDPOINT=true
    PowerShell
    PS C:\> $Env:AWS_USE_FIPS_ENDPOINT="true"
  • use_fips_endpoint 文件设置。

    use_fips_endpoint = true

在某些 Amazon Web Services 区域,部分 Amazon 服务提供支持美国联邦信息处理标准 (FIPS) 140-2 的端点。当 Amazon 服务支持 FIPS 时,此设置指定 Amazon CLI 应使用哪个 FIPS 端点。与标准 Amazon 端点不同,FIPS 端点使用符合 FIPS 140-2 的 TLS 软件库。与美国政府有业务来往的企业可能需要使用这些端点。

如果启用此设置,但不存在适用于您所在 Amazon Web Services 区域中的服务的 FIPS 端点,则 Amazon 命令可能会失败。在这种情况下,请使用 --endpoint-url 选项手动指定要在命令中使用的端点,或者使用特定于服务的端点。

有关按 Amazon Web Services 区域指定 FIPS 端点的更多信息,请参阅按服务列出的 FIPS 端点。

设置成为所有 Amazon Web Services 服务使用双堆栈端点

要路由所有服务的请求以在可用时使用双堆栈端点,请使用以下设置之一:

  • AWS_USE_DUALSTACK_ENDPOINT 环境变量。

    Linux or macOS
    $ export AWS_USE_DUALSTACK_ENDPOINT=true
    Windows Command Prompt

    为所有会话设置

    C:\> setx AWS_USE_DUALSTACK_ENDPOINT true

    仅为当前会话设置

    C:\> set AWS_USE_DUALSTACK_ENDPOINT=true
    PowerShell
    PS C:\> $Env:AWS_USE_DUALSTACK_ENDPOINT="true"
  • use_dualstack_endpoint 文件设置。

    use_dualstack_endpoint = true

允许使用双堆栈端点发送 Amazon 请求。要详细了解支持 IPv4 和 IPv6 流量的双堆栈端点,请参阅 Amazon Simple Storage Service 用户指南中的使用 Amazon S3 双堆栈端点。双堆栈端点适用于某些区域。如果不存在适用于服务和/或 Amazon Web Services 区域的双堆栈端点,则请求将失败。默认情况下,将禁用该功能。

设置特定于服务的端点

特定于服务的端点配置提供了一个选项,可使用您应 Amazon CLI 请求选择的永久端点。这些设置可以灵活地支持本地端点、VPC 端点和第三方本地 Amazon 开发环境。不同的端点可分别用于测试环境和生产环境。您可以为个别 Amazon Web Services 服务指定端点 URL。

可通过以下方式指定特定于服务的端点:

特定于服务的端点:环境变量

环境变量会覆盖配置文件中的设置,但不会覆盖命令行上指定的选项。如果您希望所有配置文件在设备上使用相同的端点,请使用环境变量。

以下是特定于服务的环境变量:

  • AWS_IGNORE_CONFIGURED_ENDPOINT_URLS – 忽略所有已配置的端点 URL,除非在命令行中指定。

    Linux or macOS
    $ export AWS_IGNORE_CONFIGURED_ENDPOINT_URLS=true
    Windows Command Prompt

    为所有会话设置

    C:\> setx AWS_IGNORE_CONFIGURED_ENDPOINT_URLS true

    仅为当前会话设置

    C:\> set AWS_IGNORE_CONFIGURED_ENDPOINT_URLS=true
    PowerShell
    PS C:\> $Env:AWS_IGNORE_CONFIGURED_ENDPOINT_URLS="true"
  • AWS_ENDPOINT_URL_<SERVICE> – 指定用于特定服务的自定义端点,在该服务中 <SERVICE> 替换为 Amazon Web Services 服务标识符。有关所有特定于服务的变量,请参阅特定于服务的端点:特定于服务的标识符列表。

    以下环境变量示例设置 Amazon Elastic Beanstalk 的端点。

    Linux or macOS
    $ export AWS_ENDPOINT_URL_ELASTIC_BEANSTALK=http://localhost:4567
    Windows Command Prompt

    为所有会话设置

    C:\> setx AWS_ENDPOINT_URL_ELASTIC_BEANSTALK http://localhost:4567

    仅为当前会话设置

    C:\> set AWS_ENDPOINT_URL_ELASTIC_BEANSTALK=http://localhost:4567
    PowerShell
    PS C:\> $Env:AWS_ENDPOINT_URL_ELASTIC_BEANSTALK="http://localhost:4567"

有关设置环境变量的更多信息,请参阅为 Amazon CLI 配置环境变量。

特定于服务的端点:共享 config 文件

在共享 config 文件中,endpoint_url 用在多个节中。要设置特定于服务的端点,请使用嵌套在 services 节内服务标识符密钥下的 endpoint_url 设置。有关在共享 config 文件中定义 services 节的详细信息,请参阅 节类型:services。

以下示例使用 services 节为 Amazon S3 配置服务特定的端点 URL 和用于其他所有服务的自定义全局端点:

[profile dev1] endpoint_url = http://localhost:1234 services = s3-specific [services testing-s3] s3 = endpoint_url = http://localhost:4567

单个配置文件可以为多个服务配置端点。以下示例在同一配置文件中为 Amazon S3 和 Amazon Elastic Beanstalk 设置服务特定的端点 URL。

有关 services 节中要使用的所有服务标识符密钥的列表,请参阅特定于服务的标识符列表。

[profile dev1] services = testing-s3-and-eb [services testing-s3-and-eb] s3 = endpoint_url = http://localhost:4567 elastic_beanstalk = endpoint_url = http://localhost:8000

“服务配置”节可以在多个配置文件中使用。以下示例有两个配置文件使用相同的 services 定义:

[profile dev1] output = json services = testing-s3 [profile dev2] output = text services = testing-s3 [services testing-s3] s3 = endpoint_url = https://localhost:4567

特定于服务的端点:特定于服务的标识符列表

Amazon Web Services 服务标识符基于 API 模型的 serviceId,不过需要将所有空格替换为下划线,并将所有字母小写。

下表列出了所有特定于服务的标识符、config 文件密钥和环境变量。

serviceId 共享 Amazon config 文件的服务标识符密钥 AWS_ENDPOINT_URL_<SERVICE> 环境变量
AccessAnalyzer accessanalyzer AWS_ENDPOINT_URL_ACCESSANALYZER
Account account AWS_ENDPOINT_URL_ACCOUNT
ACM acm AWS_ENDPOINT_URL_ACM
ACM PCA acm_pca AWS_ENDPOINT_URL_ACM_PCA
Alexa For Business alexa_for_business AWS_ENDPOINT_URL_ALEXA_FOR_BUSINESS
amp amp AWS_ENDPOINT_URL_AMP
Amplify amplify AWS_ENDPOINT_URL_AMPLIFY
AmplifyBackend amplifybackend AWS_ENDPOINT_URL_AMPLIFYBACKEND
AmplifyUIBuilder amplifyuibuilder AWS_ENDPOINT_URL_AMPLIFYUIBUILDER
API Gateway api_gateway AWS_ENDPOINT_URL_API_GATEWAY
ApiGatewayManagementApi apigatewaymanagementapi AWS_ENDPOINT_URL_APIGATEWAYMANAGEMENTAPI
ApiGatewayV2 apigatewayv2 AWS_ENDPOINT_URL_APIGATEWAYV2
AppConfig appconfig AWS_ENDPOINT_URL_APPCONFIG
AppConfigData appconfigdata AWS_ENDPOINT_URL_APPCONFIGDATA
AppFabric appfabric AWS_ENDPOINT_URL_APPFABRIC
Appflow appflow AWS_ENDPOINT_URL_APPFLOW
AppIntegrations appintegrations AWS_ENDPOINT_URL_APPINTEGRATIONS
Application Auto Scaling application_auto_scaling AWS_ENDPOINT_URL_APPLICATION_AUTO_SCALING
Application Insights application_insights AWS_ENDPOINT_URL_APPLICATION_INSIGHTS
ApplicationCostProfiler applicationcostprofiler AWS_ENDPOINT_URL_APPLICATIONCOSTPROFILER
App Mesh app_mesh AWS_ENDPOINT_URL_APP_MESH
AppRunner apprunner AWS_ENDPOINT_URL_APPRUNNER
AppStream appstream AWS_ENDPOINT_URL_APPSTREAM
AppSync appsync AWS_ENDPOINT_URL_APPSYNC
ARC Zonal Shift arc_zonal_shift AWS_ENDPOINT_URL_ARC_ZONAL_SHIFT
Artifact artifact AWS_ENDPOINT_URL_ARTIFACT
Athena athena AWS_ENDPOINT_URL_ATHENA
AuditManager auditmanager AWS_ENDPOINT_URL_AUDITMANAGER
Auto Scaling auto_scaling AWS_ENDPOINT_URL_AUTO_SCALING
Auto Scaling Plans auto_scaling_plans AWS_ENDPOINT_URL_AUTO_SCALING_PLANS
b2bi b2bi AWS_ENDPOINT_URL_B2BI
Backup backup AWS_ENDPOINT_URL_BACKUP
Backup Gateway backup_gateway AWS_ENDPOINT_URL_BACKUP_GATEWAY
BackupStorage backupstorage AWS_ENDPOINT_URL_BACKUPSTORAGE
Batch batch AWS_ENDPOINT_URL_BATCH
BCM Data Exports bcm_data_exports AWS_ENDPOINT_URL_BCM_DATA_EXPORTS
Bedrock bedrock AWS_ENDPOINT_URL_BEDROCK
Bedrock Agent bedrock_agent AWS_ENDPOINT_URL_BEDROCK_AGENT
Bedrock Agent Runtime bedrock_agent_runtime AWS_ENDPOINT_URL_BEDROCK_AGENT_RUNTIME
Bedrock Runtime bedrock_runtime AWS_ENDPOINT_URL_BEDROCK_RUNTIME
billingconductor billingconductor AWS_ENDPOINT_URL_BILLINGCONDUCTOR
Braket braket AWS_ENDPOINT_URL_BRAKET
Budgets budgets AWS_ENDPOINT_URL_BUDGETS
Cost Explorer cost_explorer AWS_ENDPOINT_URL_COST_EXPLORER
chatbot chatbot AWS_ENDPOINT_URL_CHATBOT
Chime chime AWS_ENDPOINT_URL_CHIME
Chime SDK Identity chime_sdk_identity AWS_ENDPOINT_URL_CHIME_SDK_IDENTITY
Chime SDK Media Pipelines chime_sdk_media_pipelines AWS_ENDPOINT_URL_CHIME_SDK_MEDIA_PIPELINES
Chime SDK Meetings chime_sdk_meetings AWS_ENDPOINT_URL_CHIME_SDK_MEETINGS
Chime SDK Messaging chime_sdk_messaging AWS_ENDPOINT_URL_CHIME_SDK_MESSAGING
Chime SDK Voice chime_sdk_voice AWS_ENDPOINT_URL_CHIME_SDK_VOICE
CleanRooms cleanrooms AWS_ENDPOINT_URL_CLEANROOMS
CleanRoomsML cleanroomsml AWS_ENDPOINT_URL_CLEANROOMSML
Cloud9 cloud9 AWS_ENDPOINT_URL_CLOUD9
CloudControl cloudcontrol AWS_ENDPOINT_URL_CLOUDCONTROL
CloudDirectory clouddirectory AWS_ENDPOINT_URL_CLOUDDIRECTORY
CloudFormation cloudformation AWS_ENDPOINT_URL_CLOUDFORMATION
CloudFront cloudfront AWS_ENDPOINT_URL_CLOUDFRONT
CloudFront KeyValueStore cloudfront_keyvaluestore AWS_ENDPOINT_URL_CLOUDFRONT_KEYVALUESTORE
CloudHSM cloudhsm AWS_ENDPOINT_URL_CLOUDHSM
CloudHSM V2 cloudhsm_v2 AWS_ENDPOINT_URL_CLOUDHSM_V2
CloudSearch cloudsearch AWS_ENDPOINT_URL_CLOUDSEARCH
CloudSearch Domain cloudsearch_domain AWS_ENDPOINT_URL_CLOUDSEARCH_DOMAIN
CloudTrail cloudtrail AWS_ENDPOINT_URL_CLOUDTRAIL
CloudTrail Data cloudtrail_data AWS_ENDPOINT_URL_CLOUDTRAIL_DATA
CloudWatch cloudwatch AWS_ENDPOINT_URL_CLOUDWATCH
codeartifact codeartifact AWS_ENDPOINT_URL_CODEARTIFACT
CodeBuild codebuild AWS_ENDPOINT_URL_CODEBUILD
CodeCatalyst codecatalyst AWS_ENDPOINT_URL_CODECATALYST
CodeCommit codecommit AWS_ENDPOINT_URL_CODECOMMIT
CodeDeploy codedeploy AWS_ENDPOINT_URL_CODEDEPLOY
CodeGuru Reviewer codeguru_reviewer AWS_ENDPOINT_URL_CODEGURU_REVIEWER
CodeGuru Security codeguru_security AWS_ENDPOINT_URL_CODEGURU_SECURITY
CodeGuruProfiler codeguruprofiler AWS_ENDPOINT_URL_CODEGURUPROFILER
CodePipeline codepipeline AWS_ENDPOINT_URL_CODEPIPELINE
CodeStar codestar AWS_ENDPOINT_URL_CODESTAR
CodeStar connections codestar_connections AWS_ENDPOINT_URL_CODESTAR_CONNECTIONS
codestar notifications codestar_notifications AWS_ENDPOINT_URL_CODESTAR_NOTIFICATIONS
Cognito Identity cognito_identity AWS_ENDPOINT_URL_COGNITO_IDENTITY
Cognito Identity Provider cognito_identity_provider AWS_ENDPOINT_URL_COGNITO_IDENTITY_PROVIDER
Cognito Sync cognito_sync AWS_ENDPOINT_URL_COGNITO_SYNC
Comprehend comprehend AWS_ENDPOINT_URL_COMPREHEND
ComprehendMedical comprehendmedical AWS_ENDPOINT_URL_COMPREHENDMEDICAL
Compute Optimizer compute_optimizer AWS_ENDPOINT_URL_COMPUTE_OPTIMIZER
Config Service config_service AWS_ENDPOINT_URL_CONFIG_SERVICE
Connect connect AWS_ENDPOINT_URL_CONNECT
Connect Contact Lens connect_contact_lens AWS_ENDPOINT_URL_CONNECT_CONTACT_LENS
ConnectCampaigns connectcampaigns AWS_ENDPOINT_URL_CONNECTCAMPAIGNS
ConnectCases connectcases AWS_ENDPOINT_URL_CONNECTCASES
ConnectParticipant connectparticipant AWS_ENDPOINT_URL_CONNECTPARTICIPANT
ControlTower controltower AWS_ENDPOINT_URL_CONTROLTOWER
Cost Optimization Hub cost_optimization_hub AWS_ENDPOINT_URL_COST_OPTIMIZATION_HUB
Cost and Usage Report Service cost_and_usage_report_service AWS_ENDPOINT_URL_COST_AND_USAGE_REPORT_SERVICE
Customer Profiles customer_profiles AWS_ENDPOINT_URL_CUSTOMER_PROFILES
DataBrew databrew AWS_ENDPOINT_URL_DATABREW
DataExchange dataexchange AWS_ENDPOINT_URL_DATAEXCHANGE
Data Pipeline data_pipeline AWS_ENDPOINT_URL_DATA_PIPELINE
DataSync datasync AWS_ENDPOINT_URL_DATASYNC
DataZone datazone AWS_ENDPOINT_URL_DATAZONE
DAX dax AWS_ENDPOINT_URL_DAX
Detective detective AWS_ENDPOINT_URL_DETECTIVE
Device Farm device_farm AWS_ENDPOINT_URL_DEVICE_FARM
DevOps Guru devops_guru AWS_ENDPOINT_URL_DEVOPS_GURU
Direct Connect direct_connect AWS_ENDPOINT_URL_DIRECT_CONNECT
Application Discovery Service application_discovery_service AWS_ENDPOINT_URL_APPLICATION_DISCOVERY_SERVICE
DLM dlm AWS_ENDPOINT_URL_DLM
Database Migration Service database_migration_service AWS_ENDPOINT_URL_DATABASE_MIGRATION_SERVICE
DocDB docdb AWS_ENDPOINT_URL_DOCDB
DocDB Elastic docdb_elastic AWS_ENDPOINT_URL_DOCDB_ELASTIC
drs drs AWS_ENDPOINT_URL_DRS
Directory Service directory_service AWS_ENDPOINT_URL_DIRECTORY_SERVICE
DynamoDB dynamodb AWS_ENDPOINT_URL_DYNAMODB
DynamoDB Streams dynamodb_streams AWS_ENDPOINT_URL_DYNAMODB_STREAMS
EBS ebs AWS_ENDPOINT_URL_EBS
EC2 ec2 AWS_ENDPOINT_URL_EC2
EC2 Instance Connect ec2_instance_connect AWS_ENDPOINT_URL_EC2_INSTANCE_CONNECT
ECR ecr AWS_ENDPOINT_URL_ECR
ECR PUBLIC ecr_public AWS_ENDPOINT_URL_ECR_PUBLIC
ECS ecs AWS_ENDPOINT_URL_ECS
EFS efs AWS_ENDPOINT_URL_EFS
EKS eks AWS_ENDPOINT_URL_EKS
EKS Auth eks_auth AWS_ENDPOINT_URL_EKS_AUTH
Elastic Inference elastic_inference AWS_ENDPOINT_URL_ELASTIC_INFERENCE
ElastiCache elasticache AWS_ENDPOINT_URL_ELASTICACHE
Elastic Beanstalk elastic_beanstalk AWS_ENDPOINT_URL_ELASTIC_BEANSTALK
Elastic Transcoder elastic_transcoder AWS_ENDPOINT_URL_ELASTIC_TRANSCODER
Elastic Load Balancing elastic_load_balancing AWS_ENDPOINT_URL_ELASTIC_LOAD_BALANCING
Elastic Load Balancing v2 elastic_load_balancing_v2 AWS_ENDPOINT_URL_ELASTIC_LOAD_BALANCING_V2
EMR emr AWS_ENDPOINT_URL_EMR
EMR containers emr_containers AWS_ENDPOINT_URL_EMR_CONTAINERS
EMR Serverless emr_serverless AWS_ENDPOINT_URL_EMR_SERVERLESS
EntityResolution entityresolution AWS_ENDPOINT_URL_ENTITYRESOLUTION
Elasticsearch Service elasticsearch_service AWS_ENDPOINT_URL_ELASTICSEARCH_SERVICE
EventBridge eventbridge AWS_ENDPOINT_URL_EVENTBRIDGE
Evidently evidently AWS_ENDPOINT_URL_EVIDENTLY
finspace finspace AWS_ENDPOINT_URL_FINSPACE
finspace data finspace_data AWS_ENDPOINT_URL_FINSPACE_DATA
Firehose firehose AWS_ENDPOINT_URL_FIREHOSE
fis fis AWS_ENDPOINT_URL_FIS
FMS fms AWS_ENDPOINT_URL_FMS
forecast forecast AWS_ENDPOINT_URL_FORECAST
forecastquery forecastquery AWS_ENDPOINT_URL_FORECASTQUERY
FraudDetector frauddetector AWS_ENDPOINT_URL_FRAUDDETECTOR
FreeTier freetier AWS_ENDPOINT_URL_FREETIER
FSx fsx AWS_ENDPOINT_URL_FSX
GameLift gamelift AWS_ENDPOINT_URL_GAMELIFT
Glacier glacier AWS_ENDPOINT_URL_GLACIER
Global Accelerator global_accelerator AWS_ENDPOINT_URL_GLOBAL_ACCELERATOR
Glue glue AWS_ENDPOINT_URL_GLUE
grafana grafana AWS_ENDPOINT_URL_GRAFANA
Greengrass greengrass AWS_ENDPOINT_URL_GREENGRASS
GreengrassV2 greengrassv2 AWS_ENDPOINT_URL_GREENGRASSV2
GroundStation groundstation AWS_ENDPOINT_URL_GROUNDSTATION
GuardDuty guardduty AWS_ENDPOINT_URL_GUARDDUTY
Health health AWS_ENDPOINT_URL_HEALTH
HealthLake healthlake AWS_ENDPOINT_URL_HEALTHLAKE
Honeycode honeycode AWS_ENDPOINT_URL_HONEYCODE
IAM iam AWS_ENDPOINT_URL_IAM
identitystore identitystore AWS_ENDPOINT_URL_IDENTITYSTORE
imagebuilder imagebuilder AWS_ENDPOINT_URL_IMAGEBUILDER
ImportExport importexport AWS_ENDPOINT_URL_IMPORTEXPORT
Inspector inspector AWS_ENDPOINT_URL_INSPECTOR
Inspector Scan inspector_scan AWS_ENDPOINT_URL_INSPECTOR_SCAN
Inspector2 inspector2 AWS_ENDPOINT_URL_INSPECTOR2
InternetMonitor internetmonitor AWS_ENDPOINT_URL_INTERNETMONITOR
IoT iot AWS_ENDPOINT_URL_IOT
IoT Data Plane iot_data_plane AWS_ENDPOINT_URL_IOT_DATA_PLANE
IoT Jobs Data Plane iot_jobs_data_plane AWS_ENDPOINT_URL_IOT_JOBS_DATA_PLANE
IoT 1Click Devices Service iot_1click_devices_service AWS_ENDPOINT_URL_IOT_1CLICK_DEVICES_SERVICE
IoT 1Click Projects iot_1click_projects AWS_ENDPOINT_URL_IOT_1CLICK_PROJECTS
IoTAnalytics iotanalytics AWS_ENDPOINT_URL_IOTANALYTICS
IotDeviceAdvisor iotdeviceadvisor AWS_ENDPOINT_URL_IOTDEVICEADVISOR
IoT Events iot_events AWS_ENDPOINT_URL_IOT_EVENTS
IoT Events Data iot_events_data AWS_ENDPOINT_URL_IOT_EVENTS_DATA
IoTFleetHub iotfleethub AWS_ENDPOINT_URL_IOTFLEETHUB
IoTFleetWise iotfleetwise AWS_ENDPOINT_URL_IOTFLEETWISE
IoTSecureTunneling iotsecuretunneling AWS_ENDPOINT_URL_IOTSECURETUNNELING
IoTSiteWise iotsitewise AWS_ENDPOINT_URL_IOTSITEWISE
IoTThingsGraph iotthingsgraph AWS_ENDPOINT_URL_IOTTHINGSGRAPH
IoTTwinMaker iottwinmaker AWS_ENDPOINT_URL_IOTTWINMAKER
IoT Wireless iot_wireless AWS_ENDPOINT_URL_IOT_WIRELESS
ivs ivs AWS_ENDPOINT_URL_IVS
IVS RealTime ivs_realtime AWS_ENDPOINT_URL_IVS_REALTIME
ivschat ivschat AWS_ENDPOINT_URL_IVSCHAT
Kafka kafka AWS_ENDPOINT_URL_KAFKA
KafkaConnect kafkaconnect AWS_ENDPOINT_URL_KAFKACONNECT
kendra kendra AWS_ENDPOINT_URL_KENDRA
Kendra Ranking kendra_ranking AWS_ENDPOINT_URL_KENDRA_RANKING
Keyspaces keyspaces AWS_ENDPOINT_URL_KEYSPACES
Kinesis kinesis AWS_ENDPOINT_URL_KINESIS
Kinesis Video Archived Media kinesis_video_archived_media AWS_ENDPOINT_URL_KINESIS_VIDEO_ARCHIVED_MEDIA
Kinesis Video Media kinesis_video_media AWS_ENDPOINT_URL_KINESIS_VIDEO_MEDIA
Kinesis Video Signaling kinesis_video_signaling AWS_ENDPOINT_URL_KINESIS_VIDEO_SIGNALING
Kinesis Video WebRTC Storage kinesis_video_webrtc_storage AWS_ENDPOINT_URL_KINESIS_VIDEO_WEBRTC_STORAGE
Kinesis Analytics kinesis_analytics AWS_ENDPOINT_URL_KINESIS_ANALYTICS
Kinesis Analytics V2 kinesis_analytics_v2 AWS_ENDPOINT_URL_KINESIS_ANALYTICS_V2
Kinesis Video kinesis_video AWS_ENDPOINT_URL_KINESIS_VIDEO
KMS kms AWS_ENDPOINT_URL_KMS
LakeFormation lakeformation AWS_ENDPOINT_URL_LAKEFORMATION
Lambda lambda AWS_ENDPOINT_URL_LAMBDA
Launch Wizard launch_wizard AWS_ENDPOINT_URL_LAUNCH_WIZARD
Lex Model Building Service lex_model_building_service AWS_ENDPOINT_URL_LEX_MODEL_BUILDING_SERVICE
Lex Runtime Service lex_runtime_service AWS_ENDPOINT_URL_LEX_RUNTIME_SERVICE
Lex Models V2 lex_models_v2 AWS_ENDPOINT_URL_LEX_MODELS_V2
Lex Runtime V2 lex_runtime_v2 AWS_ENDPOINT_URL_LEX_RUNTIME_V2
License Manager license_manager AWS_ENDPOINT_URL_LICENSE_MANAGER
License Manager Linux Subscriptions license_manager_linux_subscriptions AWS_ENDPOINT_URL_LICENSE_MANAGER_LINUX_SUBSCRIPTIONS
License Manager User Subscriptions license_manager_user_subscriptions AWS_ENDPOINT_URL_LICENSE_MANAGER_USER_SUBSCRIPTIONS
Lightsail lightsail AWS_ENDPOINT_URL_LIGHTSAIL
Location location AWS_ENDPOINT_URL_LOCATION
CloudWatch Logs cloudwatch_logs AWS_ENDPOINT_URL_CLOUDWATCH_LOGS
LookoutEquipment lookoutequipment AWS_ENDPOINT_URL_LOOKOUTEQUIPMENT
LookoutMetrics lookoutmetrics AWS_ENDPOINT_URL_LOOKOUTMETRICS
LookoutVision lookoutvision AWS_ENDPOINT_URL_LOOKOUTVISION
m2 m2 AWS_ENDPOINT_URL_M2
Machine Learning machine_learning AWS_ENDPOINT_URL_MACHINE_LEARNING
Macie2 macie2 AWS_ENDPOINT_URL_MACIE2
ManagedBlockchain managedblockchain AWS_ENDPOINT_URL_MANAGEDBLOCKCHAIN
ManagedBlockchain Query managedblockchain_query AWS_ENDPOINT_URL_MANAGEDBLOCKCHAIN_QUERY
Marketplace Agreement marketplace_agreement AWS_ENDPOINT_URL_MARKETPLACE_AGREEMENT
Marketplace Catalog marketplace_catalog AWS_ENDPOINT_URL_MARKETPLACE_CATALOG
Marketplace Deployment marketplace_deployment AWS_ENDPOINT_URL_MARKETPLACE_DEPLOYMENT
Marketplace Entitlement Service marketplace_entitlement_service AWS_ENDPOINT_URL_MARKETPLACE_ENTITLEMENT_SERVICE
Marketplace Commerce Analytics marketplace_commerce_analytics AWS_ENDPOINT_URL_MARKETPLACE_COMMERCE_ANALYTICS
MediaConnect mediaconnect AWS_ENDPOINT_URL_MEDIACONNECT
MediaConvert mediaconvert AWS_ENDPOINT_URL_MEDIACONVERT
MediaLive medialive AWS_ENDPOINT_URL_MEDIALIVE
MediaPackage mediapackage AWS_ENDPOINT_URL_MEDIAPACKAGE
MediaPackage Vod mediapackage_vod AWS_ENDPOINT_URL_MEDIAPACKAGE_VOD
MediaPackageV2 mediapackagev2 AWS_ENDPOINT_URL_MEDIAPACKAGEV2
MediaStore mediastore AWS_ENDPOINT_URL_MEDIASTORE
MediaStore Data mediastore_data AWS_ENDPOINT_URL_MEDIASTORE_DATA
MediaTailor mediatailor AWS_ENDPOINT_URL_MEDIATAILOR
Medical Imaging medical_imaging AWS_ENDPOINT_URL_MEDICAL_IMAGING
MemoryDB memorydb AWS_ENDPOINT_URL_MEMORYDB
Marketplace Metering marketplace_metering AWS_ENDPOINT_URL_MARKETPLACE_METERING
Migration Hub migration_hub AWS_ENDPOINT_URL_MIGRATION_HUB
mgn mgn AWS_ENDPOINT_URL_MGN
Migration Hub Refactor Spaces migration_hub_refactor_spaces AWS_ENDPOINT_URL_MIGRATION_HUB_REFACTOR_SPACES
MigrationHub Config migrationhub_config AWS_ENDPOINT_URL_MIGRATIONHUB_CONFIG
MigrationHubOrchestrator migrationhuborchestrator AWS_ENDPOINT_URL_MIGRATIONHUBORCHESTRATOR
MigrationHubStrategy migrationhubstrategy AWS_ENDPOINT_URL_MIGRATIONHUBSTRATEGY
Mobile mobile AWS_ENDPOINT_URL_MOBILE
mq mq AWS_ENDPOINT_URL_MQ
MTurk mturk AWS_ENDPOINT_URL_MTURK
MWAA mwaa AWS_ENDPOINT_URL_MWAA
Neptune neptune AWS_ENDPOINT_URL_NEPTUNE
Neptune Graph neptune_graph AWS_ENDPOINT_URL_NEPTUNE_GRAPH
neptunedata neptunedata AWS_ENDPOINT_URL_NEPTUNEDATA
Network Firewall network_firewall AWS_ENDPOINT_URL_NETWORK_FIREWALL
NetworkManager networkmanager AWS_ENDPOINT_URL_NETWORKMANAGER
NetworkMonitor networkmonitor AWS_ENDPOINT_URL_NETWORKMONITOR
nimble nimble AWS_ENDPOINT_URL_NIMBLE
OAM oam AWS_ENDPOINT_URL_OAM
Omics omics AWS_ENDPOINT_URL_OMICS
OpenSearch opensearch AWS_ENDPOINT_URL_OPENSEARCH
OpenSearchServerless opensearchserverless AWS_ENDPOINT_URL_OPENSEARCHSERVERLESS
OpsWorks opsworks AWS_ENDPOINT_URL_OPSWORKS
OpsWorksCM opsworkscm AWS_ENDPOINT_URL_OPSWORKSCM
Organizations organizations AWS_ENDPOINT_URL_ORGANIZATIONS
OSIS osis AWS_ENDPOINT_URL_OSIS
Outposts outposts AWS_ENDPOINT_URL_OUTPOSTS
p8data p8data AWS_ENDPOINT_URL_P8DATA
p8data p8data AWS_ENDPOINT_URL_P8DATA
Panorama panorama AWS_ENDPOINT_URL_PANORAMA
Payment Cryptography payment_cryptography AWS_ENDPOINT_URL_PAYMENT_CRYPTOGRAPHY
Payment Cryptography Data payment_cryptography_data AWS_ENDPOINT_URL_PAYMENT_CRYPTOGRAPHY_DATA
Pca Connector Ad pca_connector_ad AWS_ENDPOINT_URL_PCA_CONNECTOR_AD
Personalize personalize AWS_ENDPOINT_URL_PERSONALIZE
Personalize Events personalize_events AWS_ENDPOINT_URL_PERSONALIZE_EVENTS
Personalize Runtime personalize_runtime AWS_ENDPOINT_URL_PERSONALIZE_RUNTIME
PI pi AWS_ENDPOINT_URL_PI
Pinpoint pinpoint AWS_ENDPOINT_URL_PINPOINT
Pinpoint Email pinpoint_email AWS_ENDPOINT_URL_PINPOINT_EMAIL
Pinpoint SMS Voice pinpoint_sms_voice AWS_ENDPOINT_URL_PINPOINT_SMS_VOICE
Pinpoint SMS Voice V2 pinpoint_sms_voice_v2 AWS_ENDPOINT_URL_PINPOINT_SMS_VOICE_V2
Pipes pipes AWS_ENDPOINT_URL_PIPES
Polly polly AWS_ENDPOINT_URL_POLLY
Pricing pricing AWS_ENDPOINT_URL_PRICING
PrivateNetworks privatenetworks AWS_ENDPOINT_URL_PRIVATENETWORKS
Proton proton AWS_ENDPOINT_URL_PROTON
QBusiness qbusiness AWS_ENDPOINT_URL_QBUSINESS
QConnect qconnect AWS_ENDPOINT_URL_QCONNECT
QLDB qldb AWS_ENDPOINT_URL_QLDB
QLDB Session qldb_session AWS_ENDPOINT_URL_QLDB_SESSION
QuickSight quicksight AWS_ENDPOINT_URL_QUICKSIGHT
RAM ram AWS_ENDPOINT_URL_RAM
rbin rbin AWS_ENDPOINT_URL_RBIN
RDS rds AWS_ENDPOINT_URL_RDS
RDS Data rds_data AWS_ENDPOINT_URL_RDS_DATA
Redshift redshift AWS_ENDPOINT_URL_REDSHIFT
Redshift Data redshift_data AWS_ENDPOINT_URL_REDSHIFT_DATA
Redshift Serverless redshift_serverless AWS_ENDPOINT_URL_REDSHIFT_SERVERLESS
Rekognition rekognition AWS_ENDPOINT_URL_REKOGNITION
repostspace repostspace AWS_ENDPOINT_URL_REPOSTSPACE
resiliencehub resiliencehub AWS_ENDPOINT_URL_RESILIENCEHUB
Resource Explorer 2 resource_explorer_2 AWS_ENDPOINT_URL_RESOURCE_EXPLORER_2
Resource Groups resource_groups AWS_ENDPOINT_URL_RESOURCE_GROUPS
Resource Groups Tagging API resource_groups_tagging_api AWS_ENDPOINT_URL_RESOURCE_GROUPS_TAGGING_API
RoboMaker robomaker AWS_ENDPOINT_URL_ROBOMAKER
RolesAnywhere rolesanywhere AWS_ENDPOINT_URL_ROLESANYWHERE
Route 53 route_53 AWS_ENDPOINT_URL_ROUTE_53
Route53 Recovery Cluster route53_recovery_cluster AWS_ENDPOINT_URL_ROUTE53_RECOVERY_CLUSTER
Route53 Recovery Control Config route53_recovery_control_config AWS_ENDPOINT_URL_ROUTE53_RECOVERY_CONTROL_CONFIG
Route53 Recovery Readiness route53_recovery_readiness AWS_ENDPOINT_URL_ROUTE53_RECOVERY_READINESS
Route 53 Domains route_53_domains AWS_ENDPOINT_URL_ROUTE_53_DOMAINS
Route53Resolver route53resolver AWS_ENDPOINT_URL_ROUTE53RESOLVER
RUM rum AWS_ENDPOINT_URL_RUM
S3 s3 AWS_ENDPOINT_URL_S3
S3 Control s3_control AWS_ENDPOINT_URL_S3_CONTROL
S3Outposts s3outposts AWS_ENDPOINT_URL_S3OUTPOSTS
SageMaker sagemaker AWS_ENDPOINT_URL_SAGEMAKER
SageMaker A2I Runtime sagemaker_a2i_runtime AWS_ENDPOINT_URL_SAGEMAKER_A2I_RUNTIME
Sagemaker Edge sagemaker_edge AWS_ENDPOINT_URL_SAGEMAKER_EDGE
SageMaker FeatureStore Runtime sagemaker_featurestore_runtime AWS_ENDPOINT_URL_SAGEMAKER_FEATURESTORE_RUNTIME
SageMaker Geospatial sagemaker_geospatial AWS_ENDPOINT_URL_SAGEMAKER_GEOSPATIAL
SageMaker Metrics sagemaker_metrics AWS_ENDPOINT_URL_SAGEMAKER_METRICS
SageMaker Runtime sagemaker_runtime AWS_ENDPOINT_URL_SAGEMAKER_RUNTIME
savingsplans savingsplans AWS_ENDPOINT_URL_SAVINGSPLANS
Scheduler scheduler AWS_ENDPOINT_URL_SCHEDULER
schemas schemas AWS_ENDPOINT_URL_SCHEMAS
SimpleDB simpledb AWS_ENDPOINT_URL_SIMPLEDB
Secrets Manager secrets_manager AWS_ENDPOINT_URL_SECRETS_MANAGER
SecurityHub securityhub AWS_ENDPOINT_URL_SECURITYHUB
SecurityLake securitylake AWS_ENDPOINT_URL_SECURITYLAKE
ServerlessApplicationRepository serverlessapplicationrepository AWS_ENDPOINT_URL_SERVERLESSAPPLICATIONREPOSITORY
Service Quotas service_quotas AWS_ENDPOINT_URL_SERVICE_QUOTAS
Service Catalog service_catalog AWS_ENDPOINT_URL_SERVICE_CATALOG
Service Catalog AppRegistry service_catalog_appregistry AWS_ENDPOINT_URL_SERVICE_CATALOG_APPREGISTRY
ServiceDiscovery servicediscovery AWS_ENDPOINT_URL_SERVICEDISCOVERY
SES ses AWS_ENDPOINT_URL_SES
SESv2 sesv2 AWS_ENDPOINT_URL_SESV2
Shield shield AWS_ENDPOINT_URL_SHIELD
signer signer AWS_ENDPOINT_URL_SIGNER
SimSpaceWeaver simspaceweaver AWS_ENDPOINT_URL_SIMSPACEWEAVER
SMS sms AWS_ENDPOINT_URL_SMS
Snow Device Management snow_device_management AWS_ENDPOINT_URL_SNOW_DEVICE_MANAGEMENT
Snowball snowball AWS_ENDPOINT_URL_SNOWBALL
SNS sns AWS_ENDPOINT_URL_SNS
SQS sqs AWS_ENDPOINT_URL_SQS
SSM ssm AWS_ENDPOINT_URL_SSM
SSM Contacts ssm_contacts AWS_ENDPOINT_URL_SSM_CONTACTS
SSM Incidents ssm_incidents AWS_ENDPOINT_URL_SSM_INCIDENTS
Ssm Sap ssm_sap AWS_ENDPOINT_URL_SSM_SAP
SSO sso AWS_ENDPOINT_URL_SSO
SSO Admin sso_admin AWS_ENDPOINT_URL_SSO_ADMIN
SSO OIDC sso_oidc AWS_ENDPOINT_URL_SSO_OIDC
SFN sfn AWS_ENDPOINT_URL_SFN
Storage Gateway storage_gateway AWS_ENDPOINT_URL_STORAGE_GATEWAY
STS sts AWS_ENDPOINT_URL_STS
SupplyChain supplychain AWS_ENDPOINT_URL_SUPPLYCHAIN
Support support AWS_ENDPOINT_URL_SUPPORT
Support App support_app AWS_ENDPOINT_URL_SUPPORT_APP
SWF swf AWS_ENDPOINT_URL_SWF
synthetics synthetics AWS_ENDPOINT_URL_SYNTHETICS
Textract textract AWS_ENDPOINT_URL_TEXTRACT
Timestream InfluxDB timestream_influxdb AWS_ENDPOINT_URL_TIMESTREAM_INFLUXDB
Timestream Query timestream_query AWS_ENDPOINT_URL_TIMESTREAM_QUERY
Timestream Write timestream_write AWS_ENDPOINT_URL_TIMESTREAM_WRITE
tnb tnb AWS_ENDPOINT_URL_TNB
Transcribe transcribe AWS_ENDPOINT_URL_TRANSCRIBE
Transfer transfer AWS_ENDPOINT_URL_TRANSFER
Translate translate AWS_ENDPOINT_URL_TRANSLATE
TrustedAdvisor trustedadvisor AWS_ENDPOINT_URL_TRUSTEDADVISOR
VerifiedPermissions verifiedpermissions AWS_ENDPOINT_URL_VERIFIEDPERMISSIONS
Voice ID voice_id AWS_ENDPOINT_URL_VOICE_ID
VPC Lattice vpc_lattice AWS_ENDPOINT_URL_VPC_LATTICE
WAF waf AWS_ENDPOINT_URL_WAF
WAF Regional waf_regional AWS_ENDPOINT_URL_WAF_REGIONAL
WAFV2 wafv2 AWS_ENDPOINT_URL_WAFV2
WellArchitected wellarchitected AWS_ENDPOINT_URL_WELLARCHITECTED
Wisdom wisdom AWS_ENDPOINT_URL_WISDOM
WorkDocs workdocs AWS_ENDPOINT_URL_WORKDOCS
WorkLink worklink AWS_ENDPOINT_URL_WORKLINK
WorkMail workmail AWS_ENDPOINT_URL_WORKMAIL
WorkMailMessageFlow workmailmessageflow AWS_ENDPOINT_URL_WORKMAILMESSAGEFLOW
WorkSpaces workspaces AWS_ENDPOINT_URL_WORKSPACES
WorkSpaces Thin Client workspaces_thin_client AWS_ENDPOINT_URL_WORKSPACES_THIN_CLIENT
WorkSpaces Web workspaces_web AWS_ENDPOINT_URL_WORKSPACES_WEB
XRay xray AWS_ENDPOINT_URL_XRAY

基于账户的端点

可以通过以下方式指定基于账户的端点:

  • 环境变量

    • AWS_ACCOUNT_ID:指定要用于调用受支持的 Amazon Web Services 服务的基于 Amazon 账户的端点 ID。

      Linux or macOS
      $ export AWS_ACCOUNT_ID=<account-id>
      Windows Command Prompt

      为所有会话设置

      C:\> setx AWS_ACCOUNT_ID <account-id>

      仅为当前会话设置

      C:\> set AWS_ACCOUNT_ID=<account-id>
      PowerShell
      PS C:\> $Env:AWS_ACCOUNT_ID="<account-id>"
    • AWS_ACCOUNT_ID_ENDPOINT_MODE:指定是否使用基于 Amazon 账户的端点 ID 来调用受支持的 Amazon Web Services 服务。可以设置为 preferred、disabled 或 required。默认值为 preferred。

      Linux or macOS
      $ export AWS_ACCOUNT_ID_ENDPOINT_MODE=preferred
      Windows Command Prompt

      为所有会话设置

      C:\> setx AWS_ACCOUNT_ID_ENDPOINT_MODE preferred

      仅为当前会话设置

      C:\> set AWS_ACCOUNT_ID_ENDPOINT_MODE=preferred
      PowerShell
      PS C:\> $Env:AWS_ACCOUNT_ID_ENDPOINT_MODE="preferred"
  • config 文件:

    • aws_account_id:指定要用于调用受支持的 Amazon Web Services 服务的基于 Amazon 账户的端点 ID。

      aws_account_id = <account-id>
    • account_id_endpoint_mode:指定是否使用基于 Amazon 账户的端点 ID 来调用受支持的 Amazon Web Services 服务。可以设置为 preferred、disabled 或 required。首选默认值。

      account_id_endpoint_mode = preferred

基于账户的端点通过使用 Amazon 账户 ID 来简化对支持此功能的服务发出的 Amazon Web Services 服务请求的路由,有助于确保高性能和可扩展性。当您使用凭证提供商和支持基于账户的端点的服务时,Amazon CLI 会自动构造和使用基于账户的端点,而不是区域端点。

基于账户的端点使用以下格式,其中 <account-id> 替换为您的 Amazon 账户 ID,而 <region> 替换为您的 Amazon Web Services 区域:

https://<account-id>.myservice.<region>.amazonaws.com

默认情况下,在 Amazon CLI 中,基于账户的端点模式设置为 preferred。

端点配置和设置优先级

端点配置设置位于多个位置(例如,系统变量或用户环境变量、本地 Amazon 配置文件),或者在命令行上显式声明为参数。Amazon CLI 端点配置设置的优先顺序如下:

  1. --endpoint-url 命令行选项。

  2. 如果启用,则 AWS_IGNORE_CONFIGURED_ENDPOINT_URLS 全局端点环境变量或配置文件设置 ignore_configure_endpoint_urls 将忽略自定义端点。

  3. 由特定于服务的环境变量 AWS_ENDPOINT_URL_<SERVICE> 提供的值,例如 AWS_ENDPOINT_URL_DYNAMODB。

  4. AWS_USE_DUALSTACK_ENDPOINT、AWS_USE_FIPS_ENDPOINT 和 AWS_ENDPOINT_URL 环境变量提供的值。

  5. AWS_ACCOUNT_ID_ENDPOINT_MODE 环境变量使用 AWS_ACCOUNT_ID 环境变量或 aws_account_id 设置中的账户 ID 设置为 preferred 或 required。

  6. 共享 config 文件 services 节中的 endpoint_url 设置提供的特定于服务的端点值。

  7. 共享 config 文件的 profile 中的 endpoint_url 设置提供的值。

  8. use_dualstack_endpoint、use_fips_endpoint 和 endpoint_url 设置。

  9. account_id_endpoint_mode 设置使用 AWS_ACCOUNT_ID 环境变量或 aws_account_id 设置中的账户 ID 设置为 preferred 或 required。

  10. 最后使用相应的 Amazon Web Services 服务 的任何默认端点 URL。有关每个区域可用的标准服务端点的列表,请参阅《Amazon Web Services 一般参考》中的 Amazon 区域和端点。