本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
Amazon AppConfig 使用示例 Amazon CLI
以下代码示例向您展示了如何使用with来执行操作和实现常见场景 Amazon AppConfig。 Amazon Command Line Interface
操作是大型程序的代码摘录,必须在上下文中运行。您可以通过操作了解如何调用单个服务函数,还可以通过函数相关场景和跨服务示例的上下文查看操作。
场景是展示如何通过在同一服务中调用多个函数来完成特定任务任务的代码示例。
每个示例都包含一个指向的链接 GitHub,您可以在其中找到有关如何在上下文中设置和运行代码的说明。
主题
操作
以下代码示例演示如何使用 create-application
。
- Amazon CLI
-
创建应用程序
以下
create-application
示例在中创建了一个应用程序 Amazon AppConfig。aws appconfig create-application \ --name "example-application" \ --description "An application used for creating an example."
输出:
{ "Description": "An application used for creating an example.", "Id": "339ohji", "Name": "example-application" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 1:创建 Amazon AppConfig 应用程序。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateApplication
中的。
-
以下代码示例演示如何使用 create-configuration-profile
。
- Amazon CLI
-
创建配置文件
以下
create-configuration-profile
示例使用存储在 Parameter Store(Systems Manager 的一项功能)中的配置创建配置文件。aws appconfig create-configuration-profile \ --application-id "339ohji" \ --name "Example-Configuration-Profile" \ --location-uri "ssm-parameter://Example-Parameter" \ --retrieval-role-arn "arn:aws:iam::111122223333:role/Example-App-Config-Role"
输出:
{ "ApplicationId": "339ohji", "Description": null, "Id": "ur8hx2f", "LocationUri": "ssm-parameter://Example-Parameter", "Name": "Example-Configuration-Profile", "RetrievalRoleArn": "arn:aws:iam::111122223333:role/Example-App-Config-Role", "Type": null, "Validators": null }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 3:创建配置和配置配置文件。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateConfigurationProfile
中的。
-
以下代码示例演示如何使用 create-environment
。
- Amazon CLI
-
创建环境
以下
create-environment
示例使用您使用 create-applic Amazon AppConfig ation 创建的应用程序创建了一个名为 Example-Environment 的环境。aws appconfig create-environment \ --application-id "339ohji" \ --name "Example-Environment"
输出:
{ "ApplicationId": "339ohji", "Description": null, "Id": "54j1r29", "Monitors": null, "Name": "Example-Environment", "State": "ReadyForDeployment" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 2:创建环境。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateEnvironment
中的。
-
以下代码示例演示如何使用 create-extension-association
。
- Amazon CLI
-
创建扩展关联
以下
create-extension-association
示例在中创建了新的扩展关联 Amazon AppConfig。aws appconfig create-extension-association \ --region us-west-2 \ --extension-identifier S3-backup-extension \ --resource-identifier "arn:aws:appconfig:us-west-2:123456789012:application/Finance" \ --parameters S3bucket=FinanceConfigurationBackup
输出:
{ "Id": "a1b2c3d4", "ExtensionArn": "arn:aws:appconfig:us-west-2:123456789012:extension/S3-backup-extension/1", "ResourceArn": "arn:aws:appconfig:us-west-2:123456789012:application/Finance", "Parameters": { "S3bucket": "FinanceConfigurationBackup" }, "ExtensionVersionNumber": 1 }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateExtensionAssociation
中的。
-
以下代码示例演示如何使用 create-extension
。
- Amazon CLI
-
创建扩展
以下
create-extension
示例在中创建了一个新的扩展 Amazon AppConfig。aws appconfig create-extension \ --region us-west-2 \ --name S3-backup-extension \ --actions PRE_CREATE_HOSTED_CONFIGURATION_VERSION=[{Name=S3backup,Uri=arn:aws:lambda:us-west-2:123456789012:function:s3backupfunction,RoleArn=arn:aws:iam::123456789012:role/appconfigextensionrole}] \ --parameters S3bucket={Required=true}
输出:
{ "Id": "1A2B3C4D", "Name": "S3-backup-extension", "VersionNumber": 1, "Arn": "arn:aws:appconfig:us-west-2:123456789012:extension/1A2B3C4D/1", "Actions": { "PRE_CREATE_HOSTED_CONFIGURATION_VERSION": [ { "Name": "S3backup", "Uri": "arn:aws:lambda:us-west-2:123456789012:function:s3backupfunction", "RoleArn": "arn:aws:iam::123456789012:role/appconfigextensionrole" } ] }, "Parameters": { "S3bucket": { "Required": true } } }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateExtension
中的。
-
以下代码示例演示如何使用 create-hosted-configuration-version
。
- Amazon CLI
-
创建托管配置版本
以下
create-hosted-configuration-version
示例在 Amazon AppConfig 托管配置存储中创建新配置。必须先将配置内容转换为 base64。aws appconfig create-hosted-configuration-version \ --application-id "339ohji" \ --configuration-profile-id "ur8hx2f" \ --content eyAiTmFtZSI6ICJFeGFtcGxlQXBwbGljYXRpb24iLCAiSWQiOiBFeGFtcGxlSUQsICJSYW5rIjogNyB9 \ --content-type "application/json" \ configuration_version_output_file
configuration_version_output_file
的内容:{ "Name": "ExampleApplication", "Id": ExampleID, "Rank": 7 }
输出:
{ "ApplicationId": "339ohji", "ConfigurationProfileId": "ur8hx2f", "VersionNumber": "1", "ContentType": "application/json" }
有关更多信息,请参阅 Amazon Appconfig 用户指南中的关于 Amazon AppConfig 托管配置存储。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考CreateHostedConfigurationVersion
中的。
-
以下代码示例演示如何使用 delete-application
。
- Amazon CLI
-
删除应用程序
以下
delete-application
示例删除了指定的应用程序。aws appconfig delete-application \ --application-id 339ohji
此命令不生成任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 1:创建 Amazon AppConfig 应用程序。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DeleteApplication
中的。
-
以下代码示例演示如何使用 delete-configuration-profile
。
- Amazon CLI
-
删除配置文件
以下
delete-configuration-profile
示例删除了指定的配置文件。aws appconfig delete-configuration-profile \ --application-id 339ohji \ --configuration-profile-id ur8hx2f
此命令不生成任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 3:创建配置和配置配置文件。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DeleteConfigurationProfile
中的。
-
以下代码示例演示如何使用 delete-deployment-strategy
。
- Amazon CLI
-
删除部署策略
以下
delete-deployment-strategy
示例删除了指定的部署策略。aws appconfig delete-deployment-strategy \ --deployment-strategy-id 1225qzk
此命令不生成任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 4:创建部署策略。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DeleteDeploymentStrategy
中的。
-
以下代码示例演示如何使用 delete-environment
。
- Amazon CLI
-
删除环境
以下
delete-environment
示例删除了指定的应用程序环境。aws appconfig delete-environment \ --application-id 339ohji \ --environment-id 54j1r29
此命令不生成任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 2:创建环境。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DeleteEnvironment
中的。
-
以下代码示例演示如何使用 delete-extension-association
。
- Amazon CLI
-
删除扩展关联
以下
delete-extension-association
示例从中删除扩展关联 Amazon AppConfig。aws appconfig delete-extension-association \ --region us-west-2 \ --extension-association-id a1b2c3d4
此命令不生成任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DeleteExtensionAssociation
中的。
-
以下代码示例演示如何使用 delete-extension
。
- Amazon CLI
-
删除扩展
以下
delete-extension
示例从中删除一个扩展 Amazon AppConfig。aws appconfig delete-extension \ --region us-west-2 \ --extension-identifier S3-backup-extension
此命令不生成任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DeleteExtension
中的。
-
以下代码示例演示如何使用 delete-hosted-configuration-version
。
- Amazon CLI
-
删除托管配置版本
以下
delete-hosted-configuration-version
示例删除托管在托 Amazon AppConfig 管配置存储中的配置版本。aws appconfig delete-hosted-configuration-version \ --application-id 339ohji \ --configuration-profile-id ur8hx2f \ --version-number 1
输出:: 此命令不产生任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 3:创建配置和配置配置文件。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考DeleteHostedConfigurationVersion
中的。
-
以下代码示例演示如何使用 get-application
。
- Amazon CLI
-
列出应用程序的详细信息
以下
get-application
示例列出了指定应用程序的详细信息。aws appconfig get-application \ --application-id 339ohji
输出:
{ "Description": "An application used for creating an example.", "Id": "339ohji", "Name": "example-application" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的 Amazon AppConfig 工作原理。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetApplication
中的。
-
以下代码示例演示如何使用 get-configuration-profile
。
- Amazon CLI
-
检索配置文件详细信息
以下
get-configuration-profile
示例返回指定配置文件的详细信息。aws appconfig get-configuration-profile \ --application-id 339ohji \ --configuration-profile-id ur8hx2f
输出:
{ "ApplicationId": "339ohji", "Id": "ur8hx2f", "Name": "Example-Configuration-Profile", "LocationUri": "ssm-parameter://Example-Parameter", "RetrievalRoleArn": "arn:aws:iam::111122223333:role/Example-App-Config-Role" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 3:创建配置和配置配置文件。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetConfigurationProfile
中的。
-
以下代码示例演示如何使用 get-configuration
。
- Amazon CLI
-
检索配置详细信息
以下
get-configuration
示例返回示例应用程序的配置详细信息。在后续调用 get-configuration 时,使用client-configuration-version
参数仅在版本已更改时更新应用程序的配置。只有在版本更改时才更新配置可以避免调用 get-configuration 所产生的额外费用。aws appconfig get-configuration \ --application "example-application" \ --environment "Example-Environment" \ --configuration "Example-Configuration-Profile" \ --client-id "test-id" \ configuration-output-file
configuration-output-file
的内容:{ "Name": "ExampleApplication", "Id": ExampleID, "Rank": 7 }
输出:
{ "ConfigurationVersion": "1", "ContentType": "application/json" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 6:接收配置。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetConfiguration
中的。
-
以下代码示例演示如何使用 get-deployment-strategy
。
- Amazon CLI
-
检索部署策略的详细信息
以下
get-deployment-strategy
示例列出了指定部署策略的详细信息。aws appconfig get-deployment-strategy \ --deployment-strategy-id 1225qzk
输出:
{ "Id": "1225qzk", "Name": "Example-Deployment", "DeploymentDurationInMinutes": 15, "GrowthType": "LINEAR", "GrowthFactor": 25.0, "FinalBakeTimeInMinutes": 0, "ReplicateTo": "SSM_DOCUMENT" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 4:创建部署策略。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetDeploymentStrategy
中的。
-
以下代码示例演示如何使用 get-deployment
。
- Amazon CLI
-
检索部署详细信息
以下
get-deployment
示例列出了在指定环境中部署到应用程序和部署的详细信息。aws appconfig get-deployment \ --application-id 339ohji \ --environment-id 54j1r29 \ --deployment-number 1
输出:
{ "ApplicationId": "339ohji", "EnvironmentId": "54j1r29", "DeploymentStrategyId": "1225qzk", "ConfigurationProfileId": "ur8hx2f", "DeploymentNumber": 1, "ConfigurationName": "Example-Configuration-Profile", "ConfigurationLocationUri": "ssm-parameter://Example-Parameter", "ConfigurationVersion": "1", "DeploymentDurationInMinutes": 15, "GrowthType": "LINEAR", "GrowthFactor": 25.0, "FinalBakeTimeInMinutes": 0, "State": "COMPLETE", "EventLog": [ { "EventType": "DEPLOYMENT_COMPLETED", "TriggeredBy": "APPCONFIG", "Description": "Deployment completed", "OccurredAt": "2021-09-17T21:59:03.888000+00:00" }, { "EventType": "BAKE_TIME_STARTED", "TriggeredBy": "APPCONFIG", "Description": "Deployment bake time started", "OccurredAt": "2021-09-17T21:58:57.722000+00:00" }, { "EventType": "PERCENTAGE_UPDATED", "TriggeredBy": "APPCONFIG", "Description": "Configuration available to 100.00% of clients", "OccurredAt": "2021-09-17T21:55:56.816000+00:00" }, { "EventType": "PERCENTAGE_UPDATED", "TriggeredBy": "APPCONFIG", "Description": "Configuration available to 75.00% of clients", "OccurredAt": "2021-09-17T21:52:56.567000+00:00" }, { "EventType": "PERCENTAGE_UPDATED", "TriggeredBy": "APPCONFIG", "Description": "Configuration available to 50.00% of clients", "OccurredAt": "2021-09-17T21:49:55.737000+00:00" }, { "EventType": "PERCENTAGE_UPDATED", "TriggeredBy": "APPCONFIG", "Description": "Configuration available to 25.00% of clients", "OccurredAt": "2021-09-17T21:46:55.187000+00:00" }, { "EventType": "DEPLOYMENT_STARTED", "TriggeredBy": "USER", "Description": "Deployment started", "OccurredAt": "2021-09-17T21:43:54.205000+00:00" } ], "PercentageComplete": 100.0, "StartedAt": "2021-09-17T21:43:54.205000+00:00", "CompletedAt": "2021-09-17T21:59:03.888000+00:00" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 5:部署配置。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetDeployment
中的。
-
以下代码示例演示如何使用 get-environment
。
- Amazon CLI
-
检索环境详细信息
以下
get-environment
示例返回指定环境的详细信息和状态。aws appconfig get-environment \ --application-id 339ohji \ --environment-id 54j1r29
输出:
{ "ApplicationId": "339ohji", "Id": "54j1r29", "Name": "Example-Environment", "State": "ReadyForDeployment" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 2:创建环境。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetEnvironment
中的。
-
以下代码示例演示如何使用 get-extension-association
。
- Amazon CLI
-
要获取扩展关联的详细信息
以下
get-extension-association
示例显示了有关扩展关联的信息。aws appconfig get-extension-association \ --region us-west-2 \ --extension-association-id a1b2c3d4
输出:
{ "Id": "a1b2c3d4", "ExtensionArn": "arn:aws:appconfig:us-west-2:123456789012:extension/S3-backup-extension/1", "ResourceArn": "arn:aws:appconfig:us-west-2:123456789012:application/Finance", "Parameters": { "S3bucket": "FinanceConfigurationBackup" }, "ExtensionVersionNumber": 1 }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetExtensionAssociation
中的。
-
以下代码示例演示如何使用 get-extension
。
- Amazon CLI
-
获取分机详情
以下
get-extension
示例显示了有关扩展程序的信息。aws appconfig get-extension \ --region us-west-2 \ --extension-identifier S3-backup-extension
输出:
{ "Id": "1A2B3C4D", "Name": "S3-backup-extension", "VersionNumber": 1, "Arn": "arn:aws:appconfig:us-west-2:123456789012:extension/S3-backup-extension/1", "Actions": { "PRE_CREATE_HOSTED_CONFIGURATION_VERSION": [ { "Name": "S3backup", "Uri": "arn:aws:lambda:us-west-2:123456789012:function:S3backupfunction", "RoleArn": "arn:aws:iam::123456789012:role/appconfigextensionrole" } ] }, "Parameters": { "S3bucket": { "Required": true } } }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetExtension
中的。
-
以下代码示例演示如何使用 get-hosted-configuration-version
。
- Amazon CLI
-
检索托管配置的详细信息
以下
get-hosted-configuration-version
示例检索 Amazon AppConfig 托管配置的配置详细信息。aws appconfig get-hosted-configuration-version \ --application-id 339ohji \ --configuration-profile-id ur8hx2f \ --version-number 1 \ hosted-configuration-version-output
hosted-configuration-version-output
的内容:{ "Name": "ExampleApplication", "Id": ExampleID, "Rank": 7 }
输出:
{ "ApplicationId": "339ohji", "ConfigurationProfileId": "ur8hx2f", "VersionNumber": "1", "ContentType": "application/json" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的关于 Amazon AppConfig 托管配置存储。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考GetHostedConfigurationVersion
中的。
-
以下代码示例演示如何使用 list-applications
。
- Amazon CLI
-
列出可用的应用程序
以下
list-applications
示例列出了您 Amazon 账户中的可用应用程序。aws appconfig list-applications
输出:
{ "Items": [ { "Id": "339ohji", "Name": "test-application", "Description": "An application used for creating an example." }, { "Id": "rwalwu7", "Name": "Test-Application" } ] }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 1:创建 Amazon AppConfig 应用程序。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListApplications
中的。
-
以下代码示例演示如何使用 list-configuration-profiles
。
- Amazon CLI
-
列出可用的配置文件
以下
list-configuration-profiles
示例列出了指定应用程序的可用配置文件。aws appconfig list-configuration-profiles \ --application-id 339ohji
输出:
{ "Items": [ { "ApplicationId": "339ohji", "Id": "ur8hx2f", "Name": "Example-Configuration-Profile", "LocationUri": "ssm-parameter://Example-Parameter" } ] }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 3:创建配置和配置配置文件。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListConfigurationProfiles
中的。
-
以下代码示例演示如何使用 list-deployment-strategies
。
- Amazon CLI
-
列出可用的部署策略
以下
list-deployment-strategies
示例列出了您的 Amazon 账户中可用的部署策略。aws appconfig list-deployment-strategies
输出:
{ "Items": [ { "Id": "1225qzk", "Name": "Example-Deployment", "DeploymentDurationInMinutes": 15, "GrowthType": "LINEAR", "GrowthFactor": 25.0, "FinalBakeTimeInMinutes": 0, "ReplicateTo": "SSM_DOCUMENT" }, { "Id": "AppConfig.AllAtOnce", "Name": "AppConfig.AllAtOnce", "Description": "Quick", "DeploymentDurationInMinutes": 0, "GrowthType": "LINEAR", "GrowthFactor": 100.0, "FinalBakeTimeInMinutes": 10, "ReplicateTo": "NONE" }, { "Id": "AppConfig.Linear50PercentEvery30Seconds", "Name": "AppConfig.Linear50PercentEvery30Seconds", "Description": "Test/Demo", "DeploymentDurationInMinutes": 1, "GrowthType": "LINEAR", "GrowthFactor": 50.0, "FinalBakeTimeInMinutes": 1, "ReplicateTo": "NONE" }, { "Id": "AppConfig.Canary10Percent20Minutes", "Name": "AppConfig.Canary10Percent20Minutes", "Description": "AWS Recommended", "DeploymentDurationInMinutes": 20, "GrowthType": "EXPONENTIAL", "GrowthFactor": 10.0, "FinalBakeTimeInMinutes": 10, "ReplicateTo": "NONE" } ] }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 4:创建部署策略。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListDeploymentStrategies
中的。
-
以下代码示例演示如何使用 list-deployments
。
- Amazon CLI
-
列出可用部署
以下
list-deployments
示例列出了您的 Amazon 账户中针对指定应用程序和环境的可用部署。aws appconfig list-deployments \ --application-id 339ohji \ --environment-id 54j1r29
输出:
{ "Items": [ { "DeploymentNumber": 1, "ConfigurationName": "Example-Configuration-Profile", "ConfigurationVersion": "1", "DeploymentDurationInMinutes": 15, "GrowthType": "LINEAR", "GrowthFactor": 25.0, "FinalBakeTimeInMinutes": 0, "State": "COMPLETE", "PercentageComplete": 100.0, "StartedAt": "2021-09-17T21:43:54.205000+00:00", "CompletedAt": "2021-09-17T21:59:03.888000+00:00" } ] }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 5:部署配置。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListDeployments
中的。
-
以下代码示例演示如何使用 list-environments
。
- Amazon CLI
-
列出可用环境
以下
list-environments
示例列出了您 Amazon 账户中指定应用程序的可用环境。aws appconfig list-environments \ --application-id 339ohji
输出:
{ "Items": [ { "ApplicationId": "339ohji", "Id": "54j1r29", "Name": "Example-Environment", "State": "ReadyForDeployment" } ] }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 2:创建环境。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListEnvironments
中的。
-
以下代码示例演示如何使用 list-extension-associations
。
- Amazon CLI
-
列出您 Amazon 账户中某个 Amazon 地区的所有 Amazon AppConfig 分机关联
以下
list-extension-associations
示例列出了特定 Amazon 区域中当前 Amazon 账户的所有 Amazon AppConfig 分机关联。aws appconfig list-extension-associations \ --region us-west-2
输出:
{ "Items": [ { "Id": "a1b2c3d4", "ExtensionArn": "arn:aws:appconfig:us-west-2:123456789012:extension/S3-backup-extension/1", "ResourceArn": "arn:aws:appconfig:us-west-2:123456789012:application/Finance" } ] }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListExtensionAssociations
中的。
-
以下代码示例演示如何使用 list-extensions
。
- Amazon CLI
-
列出您 Amazon 账户中某个 Amazon 地区的所有 Amazon AppConfig 扩展程序
以下
list-extensions
示例列出了特定 Amazon 区域中当前 Amazon 账户的所有 Amazon AppConfig 扩展名。该命令返回自定义和 Amazon 创作的扩展。aws appconfig list-extensions \ --region us-west-2
输出:
{ "Items": [ { "Id": "1A2B3C4D", "Name": "S3-backup-extension", "VersionNumber": 1, "Arn": "arn:aws:appconfig:us-west-2:123456789012:extension/1A2B3C4D/1" }, { "Id": "AWS.AppConfig.FeatureFlags", "Name": "AppConfig Feature Flags Helper", "VersionNumber": 1, "Arn": "arn:aws:appconfig:us-west-2::extension/AWS.AppConfig.FeatureFlags/1", "Description": "Validates AppConfig feature flag data automatically against a JSON schema that includes structure and constraints. Also transforms feature flag data prior to sending to the client. This extension is automatically associated to configuration profiles with type \"AWS.AppConfig.FeatureFlags\"." }, { "Id": "AWS.AppConfig.JiraIntegration", "Name": "AppConfig integration with Atlassian Jira", "VersionNumber": 1, "Arn": "arn:aws:appconfig:us-west-2::extension/AWS.AppConfig.JiraIntegration/1", "Description": "Exports feature flag data from AWS AppConfig into Jira. The lifecycle of each feature flag in AppConfig is tracked in Jira as an individual issue. Customers can see in Jira when flags are updated, turned on or off. Works in conjunction with the AppConfig app in the Atlassian Marketplace and is automatically associated to configuration profiles configured within that app." }, { "Id": "AWS.AppConfig.DeploymentNotificationsToEventBridge", "Name": "AppConfig deployment events to Amazon EventBridge", "VersionNumber": 1, "Arn": "arn:aws:appconfig:us-west-2::extension/AWS.AppConfig.DeploymentNotificationsToEventBridge/1", "Description": "Sends events to Amazon EventBridge when a deployment of configuration data in AppConfig is started, completed, or rolled back. Can be associated to the following resources in AppConfig: Application, Environment, Configuration Profile." }, { "Id": "AWS.AppConfig.DeploymentNotificationsToSqs", "Name": "AppConfig deployment events to Amazon SQS", "VersionNumber": 1, "Arn": "arn:aws:appconfig:us-west-2::extension/AWS.AppConfig.DeploymentNotificationsToSqs/1", "Description": "Sends messages to the configured Amazon SQS queue when a deployment of configuration data in AppConfig is started, completed, or rolled back. Can be associated to the following resources in AppConfig: Application, Environment, Configuration Profile." }, { "Id": "AWS.AppConfig.DeploymentNotificationsToSns", "Name": "AppConfig deployment events to Amazon SNS", "VersionNumber": 1, "Description": "Sends events to the configured Amazon SNS topic when a deployment of configuration data in AppConfig is started, completed, or rolled back. Can be associated to the following resources in AppConfig: Application, Environment, Configuration Profile." } ] }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListExtensions
中的。
-
以下代码示例演示如何使用 list-hosted-configuration-versions
。
- Amazon CLI
-
列出可用的托管配置版本
以下
list-hosted-configuration-versions
示例列出了托管在托 Amazon AppConfig 管配置存储中针对指定应用程序和配置文件的配置版本。aws appconfig list-hosted-configuration-versions \ --application-id 339ohji \ --configuration-profile-id ur8hx2f
输出:
{ "Items": [ { "ApplicationId": "339ohji", "ConfigurationProfileId": "ur8hx2f", "VersionNumber": 1, "ContentType": "application/json" } ] }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的关于 Amazon AppConfig 托管配置存储。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListHostedConfigurationVersions
中的。
-
以下代码示例演示如何使用 list-tags-for-resource
。
- Amazon CLI
-
列出应用程序的标签
以下
list-tags-for-resource
示例列出了指定应用程序的标签。aws appconfig list-tags-for-resource \ --resource-arn arn:aws:appconfig:us-east-1:682428703967:application/339ohji
输出:
{ "Tags": { "group1": "1" } }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 1:创建 Amazon AppConfig 应用程序。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ListTagsForResource
中的。
-
以下代码示例演示如何使用 start-deployment
。
- Amazon CLI
-
开始配置部署
以下
start-deployment
示例使用指定的环境、部署策略和配置文件开始部署到应用程序。aws appconfig start-deployment \ --application-id 339ohji \ --environment-id 54j1r29 \ --deployment-strategy-id 1225qzk \ --configuration-profile-id ur8hx2f \ --configuration-version 1
输出:
{ "ApplicationId": "339ohji", "EnvironmentId": "54j1r29", "DeploymentStrategyId": "1225qzk", "ConfigurationProfileId": "ur8hx2f", "DeploymentNumber": 1, "ConfigurationName": "Example-Configuration-Profile", "ConfigurationLocationUri": "ssm-parameter://Example-Parameter", "ConfigurationVersion": "1", "DeploymentDurationInMinutes": 15, "GrowthType": "LINEAR", "GrowthFactor": 25.0, "FinalBakeTimeInMinutes": 0, "State": "DEPLOYING", "EventLog": [ { "EventType": "DEPLOYMENT_STARTED", "TriggeredBy": "USER", "Description": "Deployment started", "OccurredAt": "2021-09-17T21:43:54.205000+00:00" } ], "PercentageComplete": 0.0, "StartedAt": "2021-09-17T21:43:54.205000+00:00" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 5:部署配置。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考StartDeployment
中的。
-
以下代码示例演示如何使用 stop-deployment
。
- Amazon CLI
-
停止配置部署
以下
stop-deployment
示例停止将应用程序配置部署到指定环境。aws appconfig stop-deployment \ --application-id 339ohji \ --environment-id 54j1r29 \ --deployment-number 2
输出:
{ "DeploymentNumber": 0, "DeploymentDurationInMinutes": 0, "GrowthFactor": 0.0, "FinalBakeTimeInMinutes": 0, "PercentageComplete": 0.0 }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 5:部署配置。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考StopDeployment
中的。
-
以下代码示例演示如何使用 tag-resource
。
- Amazon CLI
-
为应用程序添加标签
以下
tag-resource
示例为应用程序资源添加了标签。aws appconfig tag-resource \ --resource-arn arn:aws:appconfig:us-east-1:682428703967:application/339ohji \ --tags '{"group1" : "1"}'
此命令不生成任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 1:创建 Amazon AppConfig 应用程序。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考TagResource
中的。
-
以下代码示例演示如何使用 untag-resource
。
- Amazon CLI
-
从应用程序中移除标签
以下
untag-resource
示例从指定的应用程序中删除 group1 标签。aws appconfig untag-resource \ --resource-arn arn:aws:appconfig:us-east-1:111122223333:application/339ohji \ --tag-keys '["group1"]'
此命令不生成任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 1:创建 Amazon AppConfig 应用程序。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考UntagResource
中的。
-
以下代码示例演示如何使用 update-application
。
- Amazon CLI
-
更新应用程序
以下
update-application
示例更新了指定应用程序的名称。aws appconfig update-application \ --application-id 339ohji \ --name "Example-Application"
输出:
{ "Id": "339ohji", "Name": "Example-Application", "Description": "An application used for creating an example." }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 1:创建 Amazon AppConfig 应用程序。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考UpdateApplication
中的。
-
以下代码示例演示如何使用 update-configuration-profile
。
- Amazon CLI
-
更新配置文件
以下
update-configuration-profile
示例更新了指定配置文件的描述。aws appconfig update-configuration-profile \ --application-id 339ohji \ --configuration-profile-id ur8hx2f \ --description "Configuration profile used for examples."
输出:
{ "ApplicationId": "339ohji", "Id": "ur8hx2f", "Name": "Example-Configuration-Profile", "Description": "Configuration profile used for examples.", "LocationUri": "ssm-parameter://Example-Parameter", "RetrievalRoleArn": "arn:aws:iam::111122223333:role/Example-App-Config-Role" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 3:创建配置和配置配置文件。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考UpdateConfigurationProfile
中的。
-
以下代码示例演示如何使用 update-deployment-strategy
。
- Amazon CLI
-
更新部署策略
以下
update-deployment-strategy
示例将指定部署策略中的最终烘焙时间更新为 20 分钟。aws appconfig update-deployment-strategy \ --deployment-strategy-id 1225qzk \ --final-bake-time-in-minutes 20
输出:
{ "Id": "1225qzk", "Name": "Example-Deployment", "DeploymentDurationInMinutes": 15, "GrowthType": "LINEAR", "GrowthFactor": 25.0, "FinalBakeTimeInMinutes": 20, "ReplicateTo": "SSM_DOCUMENT" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 4:创建部署策略。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考UpdateDeploymentStrategy
中的。
-
以下代码示例演示如何使用 update-environment
。
- Amazon CLI
-
更新环境
以下
update-environment
示例更新了环境的描述。aws appconfig update-environment \ --application-id 339ohji \ --environment-id 54j1r29 \ --description "An environment for examples."
输出:
{ "ApplicationId": "339ohji", "Id": "54j1r29", "Name": "Example-Environment", "Description": "An environment for examples.", "State": "RolledBack" }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 2:创建环境。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考UpdateEnvironment
中的。
-
以下代码示例演示如何使用 update-extension-association
。
- Amazon CLI
-
更新 Amazon AppConfig 扩展关联
以下
update-extension-association
示例向中的扩展关联添加了一个新的参数值 Amazon AppConfig。aws appconfig update-extension-association \ --region us-west-2 \ --extension-association-id a1b2c3d4 \ --parameters S3bucket=FinanceMobileApp
输出:
{ "Id": "a1b2c3d4", "ExtensionArn": "arn:aws:appconfig:us-west-2:123456789012:extension/S3-backup-extension/1", "ResourceArn": "arn:aws:appconfig:us-west-2:123456789012:application/Finance", "Parameters": { "S3bucket": "FinanceMobileApp" }, "ExtensionVersionNumber": 1 }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考UpdateExtensionAssociation
中的。
-
以下代码示例演示如何使用 update-extension
。
- Amazon CLI
-
更新 Amazon AppConfig 扩展程序
以下
update-extension
示例向中的扩展添加了附加参数 Key Amazon AppConfig。aws appconfig update-extension \ --region us-west-2 \ --extension-identifier S3-backup-extension \ --parameters S3bucket={Required=true},CampaignID={Required=false}
输出:
{ "Id": "1A2B3C4D", "Name": "S3-backup-extension", "VersionNumber": 1, "Arn": "arn:aws:appconfig:us-west-2:123456789012:extension/1A2B3C4D/1", "Actions": { "PRE_CREATE_HOSTED_CONFIGURATION_VERSION": [ { "Name": "S3backup", "Uri": "arn:aws:lambda:us-west-2:123456789012:function:S3backupfunction", "RoleArn": "arn:aws:iam::123456789012:role/appconfigextensionrole" } ] }, "Parameters": { "CampaignID": { "Required": false }, "S3bucket": { "Required": true } } }
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的使用 Amazon AppConfig 扩展。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考UpdateExtension
中的。
-
以下代码示例演示如何使用 validate-configuration
。
- Amazon CLI
-
验证配置
以下
validate-configuration
示例使用配置文件中的验证器来验证配置。aws appconfig validate-configuration \ --application-id abc1234 \ --configuration-profile-id ur8hx2f \ --configuration-version 1
该命令不产生任何输出。
有关更多信息,请参阅《Amazon AppConfig 用户指南》中的步骤 3:创建配置和配置配置文件。
-
有关 API 的详细信息,请参阅Amazon CLI 命令参考ValidateConfiguration
中的。
-