Beispiele für die Verwendung der AWS CLI mit App Runner
Die folgenden Codebeispiele zeigen, wie Sie Aktionen durchführen und gängige Szenarien implementieren, indem Sie die AWS Command Line Interface mit App Runner nutzen.
Aktionen sind Codeauszüge aus größeren Programmen und müssen im Kontext ausgeführt werden. Während Aktionen Ihnen zeigen, wie Sie einzelne Service-Funktionen aufrufen, können Sie Aktionen im Kontext der zugehörigen Szenarien anzeigen.
Jedes Beispiel enthält einen Link zum vollständigen Quellcode, wo Sie Anleitungen zum Einrichten und Ausführen des Codes im Kontext finden.
Themen
Aktionen
Das folgende Codebeispiel zeigt, wie associate-custom-domain verwendet wird.
- AWS CLI
-
So weisen Sie einem Service einen Domainnamen und die www-Subdomain zu
Im folgenden Beispiel für
associate-custom-domainwird ein benutzerdefinierter Domainname, den Sie steuern, einem App-Runner-Service zugeordnet. Der Domainname ist die Stammdomainexample.com, einschließlich der Subdomain für Sonderfällewww.example.com.aws apprunner associate-custom-domain \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "DomainName": "example.com", "EnableWWWSubdomain": true }Ausgabe:
{ "CustomDomain": { "CertificateValidationRecords": [ { "Name": "_70d3f50a94f7c72dc28784cf55db2f6b.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_1270c137383c6307b6832db02504c4b0.bsgbmzkfwj.acm-validations.aws." }, { "Name": "_287870d3f50a94f7c72dc4cf55db2f6b.www.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_832db01270c137383c6307b62504c4b0.mzkbsgbfwj.acm-validations.aws." } ], "DomainName": "example.com", "EnableWWWSubdomain": true, "Status": "CREATING" }, "DNSTarget": "psbqam834h.us-east-1.awsapprunner.com", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }-
API-Details finden Sie unter AssociateCustomDomain
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie create-auto-scaling-configuration verwendet wird.
- AWS CLI
-
So erstellen Sie eine Auto-Scaling-Konfiguration mit hoher Verfügbarkeit
Im folgenden Beispiel für
create-auto-scaling-configurationwird eine für hohe Verfügbarkeit optimierte Auto-Scaling-Konfiguration erstellt, indem der WertMinSizeauf 5 gesetzt wird. Mit dieser Konfiguration versucht App Runner, Ihre Service-Instances auf möglichst viele Availability Zones zu verteilen, je nach AWS-Region bis zu fünf.Der Aufruf gibt ein
AutoScalingConfiguration-Objekt zurück, bei dem die anderen Einstellungen auf die Standardwerte festgelegt sind. In diesem Beispiel ist dies der erste Aufruf zur Erstellung einer Konfiguration mit dem Namenhigh-availability. Die Revision ist auf 1 gesetzt und es ist die neueste Revision.aws apprunner create-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "AutoScalingConfigurationName": "high-availability", "MinSize": 5 }Ausgabe:
{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1/2f50e7656d7819fead0f59672e68042e", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 1, "CreatedAt": "2020-11-03T00:29:17Z", "Latest": true, "Status": "ACTIVE", "MaxConcurrency": 100, "MaxSize": 50, "MinSize": 5 } }-
API-Details finden Sie unter CreateAutoScalingConfiguration
in derAWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie create-connection verwendet wird.
- AWS CLI
-
So stellen Sie eine GitHub-Verbindung her
Im folgenden Beispiel für
create-connectionwird eine Verbindung mit einem privaten GitHub-Code-Repository hergestellt. Der Verbindungsstatus nach einem erfolgreichen Anruf lautetPENDING_HANDSHAKE. Dies liegt daran, dass ein Authentifizierungs-Handshake mit dem Anbieter immer noch nicht stattgefunden hat. Schließen Sie den Handshake mit der App-Runner-Konsole ab.aws apprunner create-connection \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ConnectionName": "my-github-connection", "ProviderType": "GITHUB" }Ausgabe:
{ "Connection": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection", "ConnectionName": "my-github-connection", "Status": "PENDING_HANDSHAKE", "CreatedAt": "2020-11-03T00:32:51Z", "ProviderType": "GITHUB" } }Weitere Informationen finden Sie unter Verwalten von App-Runner-Verbindungen im Entwicklerhandbuch zu App Runner.
-
API-Details finden Sie unter CreateConnection
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie create-service verwendet wird.
- AWS CLI
-
Beispiel 1: So erstellen Sie einen Quellcode-Repository-Service
Im folgenden Beispiel für
create-servicewird ein App-Runner-Service auf der Grundlage eines Python-Quellcode-Repositorys erstellt.aws apprunner create-service \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceName": "python-app", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" }, "CodeConfiguration": { "ConfigurationSource": "API", "CodeConfigurationValues": { "Runtime": "PYTHON_3", "BuildCommand": "pip install -r requirements.txt", "StartCommand": "python server.py", "Port": "8080", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ] } } } }, "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } }Ausgabe:
{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-20T19:05:25Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }Beispiel 2: So erstellen Sie einen Quellcode-Repository-Service
Im folgenden Beispiel für
create-servicewird ein App-Runner-Service auf der Grundlage eines Python-Quellcode-Repositorys erstellt.aws apprunner create-service \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceName": "python-app", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" }, "CodeConfiguration": { "ConfigurationSource": "API", "CodeConfigurationValues": { "Runtime": "PYTHON_3", "BuildCommand": "pip install -r requirements.txt", "StartCommand": "python server.py", "Port": "8080", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ] } } } }, "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } }Ausgabe:
{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-20T19:05:25Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }Beispiel 3: So erstellen Sie einen Quell-Image-Repository-Service
Im folgenden Beispiel für
create-servicewird ein App-Runner-Service auf der Grundlage eines in Elastic Container Registry (ECR) gespeicherten Images erstellt.aws apprunner create-service \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceName": "golang-container-app", "SourceConfiguration": { "AuthenticationConfiguration": { "AccessRoleArn": "arn:aws:iam::123456789012:role/my-ecr-role" }, "AutoDeploymentsEnabled": true, "ImageRepository": { "ImageIdentifier": "123456789012.dkr.ecr.us-east-1.amazonaws.com/golang-app:latest", "ImageConfiguration": { "Port": "8080", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ] }, "ImageRepositoryType": "ECR" } }, "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } }Ausgabe:
{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-06T23:15:30Z", "UpdatedAt": "2020-11-06T23:15:30Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/golang-container-app/51728f8a20ce46d39b25398a6c8e9d1a", "ServiceId": "51728f8a20ce46d39b25398a6c8e9d1a", "ServiceName": "golang-container-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "AccessRoleArn": "arn:aws:iam::123456789012:role/my-ecr-role" }, "AutoDeploymentsEnabled": true, "ImageRepository": { "ImageIdentifier": "123456789012.dkr.ecr.us-east-1.amazonaws.com/golang-app:latest", "ImageConfiguration": { "Port": "8080", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ] }, "ImageRepositoryType": "ECR" } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }-
API-Details finden Sie unter CreateService
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie delete-auto-scaling-configuration verwendet wird.
- AWS CLI
-
Beispiel 1: So löschen Sie die letzte aktive Revision einer Auto-Scaling-Konfiguration
Im folgenden Beispiel für
delete-auto-scaling-configurationwird die letzte aktive Revision einer Auto-Scaling-Konfiguration für App Runner gelöscht. Um die letzte aktive Revision zu löschen, geben Sie einen Amazon-Ressourcennamen (ARN) an, der mit dem Konfigurationsnamen endet, ohne die Revisionskomponente.In diesem Beispiel sind vor dieser Aktion zwei Revisionen vorhanden. Daher wird Revision 2 (die neueste) gelöscht. Jetzt wird jedoch
"Latest": falseangezeigt, da es sich nach dem Löschen nicht mehr um die letzte aktive Revision handelt.aws apprunner delete-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability" }Ausgabe:
{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/2/e76562f50d78042e819fead0f59672e6", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 2, "CreatedAt": "2021-02-25T17:42:59Z", "DeletedAt": "2021-03-02T08:07:06Z", "Latest": false, "Status": "INACTIVE", "MaxConcurrency": 30, "MaxSize": 90, "MinSize": 5 } }Beispiel 2: So löschen Sie eine bestimmte Revision einer Auto-Scaling-Konfiguration
Im folgenden Beispiel für
delete-auto-scaling-configurationwird eine bestimmte Revision einer Auto-Scaling-Konfiguration für App Runner gelöscht. Um eine bestimmte Revision zu löschen, geben Sie einen ARN an, der die Revisionsnummer enthält.In diesem Beispiel sind vor dieser Aktion zwei Revisionen vorhanden. Die Aktion löscht die Revision
1.aws apprunner delete-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1" }Ausgabe:
{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1/2f50e7656d7819fead0f59672e68042e", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 1, "CreatedAt": "2020-11-03T00:29:17Z", "DeletedAt": "2021-03-02T08:07:06Z", "Latest": false, "Status": "INACTIVE", "MaxConcurrency": 100, "MaxSize": 50, "MinSize": 5 } }-
API-Details finden Sie unter DeleteAutoScalingConfiguration
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie delete-connection verwendet wird.
- AWS CLI
-
So löschen Sie eine Verbindung
Im folgenden Beispiel für
delete-connectionwird eine App-Runner-Verbindung gelöscht. Der Verbindungsstatus nach einem erfolgreichen Anruf lautetDELETED. Das liegt daran, dass die Verbindung nicht mehr verfügbar ist.aws apprunner delete-connection \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection" }Ausgabe:
{ "Connection": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection", "ConnectionName": "my-github-connection", "Status": "DELETED", "CreatedAt": "2020-11-03T00:32:51Z", "ProviderType": "GITHUB" } }-
API-Details finden Sie unter DeleteConnection
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie delete-service verwendet wird.
- AWS CLI
-
So löschen Sie einen Service
Im folgenden Beispiel für
delete-servicewird ein App-Runner-Service gelöscht.aws apprunner delete-service \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Ausgabe:
{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-20T19:05:25Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }-
API-Details finden Sie unter DeleteService
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie describe-auto-scaling-configuration verwendet wird.
- AWS CLI
-
Beispiel 1: So beschreiben Sie die letzte aktive Revision einer Auto-Scaling-Konfiguration
Im folgenden Beispiel für
describe-auto-scaling-configurationwird eine Beschreibung der letzten aktiven Revision einer Auto-Scaling-Konfiguration für App Runner abgerufen. Um die letzte aktive Revision zu beschreiben, geben Sie einen ARN an, der mit dem Konfigurationsnamen endet, ohne die Revisionskomponente.In dem Beispiel sind zwei Revisionen vorhanden. Daher wird Revision
2(die neueste) beschrieben. Das resultierende Objekt zeigt"Latest": truean.aws apprunner describe-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability" }Ausgabe:
{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/2/e76562f50d78042e819fead0f59672e6", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 2, "CreatedAt": "2021-02-25T17:42:59Z", "Latest": true, "Status": "ACTIVE", "MaxConcurrency": 30, "MaxSize": 90, "MinSize": 5 } }Beispiel 2: So beschreiben Sie eine bestimmte Revision einer Auto-Scaling-Konfiguration
Im folgenden Beispiel für
describe-auto-scaling-configurationwird eine Beschreibung einer bestimmten Revision einer Auto-Scaling-Konfiguration für App Runner abgerufen. Um eine bestimmte Revision zu beschreiben, geben Sie einen ARN an, der die Revisionsnummer enthält.In dem Beispiel existieren mehrere Revisionen und die Revision
1wird abgefragt. Das resultierende Objekt zeigt"Latest": falsean.aws apprunner describe-auto-scaling-configuration \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1" }Ausgabe:
{ "AutoScalingConfiguration": { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/1/2f50e7656d7819fead0f59672e68042e", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 1, "CreatedAt": "2020-11-03T00:29:17Z", "Latest": false, "Status": "ACTIVE", "MaxConcurrency": 100, "MaxSize": 50, "MinSize": 5 } }-
API-Details finden Sie unter DescribeAutoScalingConfiguration
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie describe-custom-domains verwendet wird.
- AWS CLI
-
So rufen Sie Beschreibungen von benutzerdefinierten Domainnamen ab, die einem Service zugeordnet sind
Im folgenden Beispiel für
describe-custom-domainswerden Beschreibungen und der Status der benutzerdefinierten Domainnamen abgerufen, die einem App-Runner-Service zugeordnet sind.aws apprunner describe-custom-domains \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "DomainName": "example.com", "EnableWWWSubdomain": true }Ausgabe:
{ "CustomDomains": [ { "CertificateValidationRecords": [ { "Name": "_70d3f50a94f7c72dc28784cf55db2f6b.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_1270c137383c6307b6832db02504c4b0.bsgbmzkfwj.acm-validations.aws." }, { "Name": "_287870d3f50a94f7c72dc4cf55db2f6b.www.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_832db01270c137383c6307b62504c4b0.mzkbsgbfwj.acm-validations.aws." } ], "DomainName": "example.com", "EnableWWWSubdomain": true, "Status": "PENDING_CERTIFICATE_DNS_VALIDATION" }, { "CertificateValidationRecords": [ { "Name": "_a94f784c70d3f507c72dc28f55db2f6b.deals.example.com", "Status": "SUCCESS", "Type": "CNAME", "Value": "_2db02504c1270c137383c6307b6834b0.bsgbmzkfwj.acm-validations.aws." } ], "DomainName": "deals.example.com", "EnableWWWSubdomain": false, "Status": "ACTIVE" } ], "DNSTarget": "psbqam834h.us-east-1.awsapprunner.com", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }-
API-Details finden Sie unter DescribeCustomDomains
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie describe-service verwendet wird.
- AWS CLI
-
So beschreiben Sie einen Service
Im folgenden Beispiel für
describe-servicewird eine Beschreibung eines App-Runner-Service abgerufen.aws apprunner describe-service \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Ausgabe:
{ "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-20T19:05:25Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "RUNNING", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }-
API-Details finden Sie unter DescribeService
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie disassociate-custom-domain verwendet wird.
- AWS CLI
-
So heben Sie die Zuordnung eines Domainnamens zu einem Service auf
Im folgenden Beispiel für
disassociate-custom-domainwird die Zuordnung der Domainexample.comzu einem App-Runner-Service aufgehoben. Durch den Aufruf wird auch die Zuordnung der Subdomainwww.example.comaufgehoben, die zusammen mit der Stammdomain zugeordnet war.aws apprunner disassociate-custom-domain \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "DomainName": "example.com" }Ausgabe:
{ "CustomDomain": { "CertificateValidationRecords": [ { "Name": "_70d3f50a94f7c72dc28784cf55db2f6b.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_1270c137383c6307b6832db02504c4b0.bsgbmzkfwj.acm-validations.aws." }, { "Name": "_287870d3f50a94f7c72dc4cf55db2f6b.www.example.com", "Status": "PENDING_VALIDATION", "Type": "CNAME", "Value": "_832db01270c137383c6307b62504c4b0.mzkbsgbfwj.acm-validations.aws." } ], "DomainName": "example.com", "EnableWWWSubdomain": true, "Status": "DELETING" }, "DNSTarget": "psbqam834h.us-east-1.awsapprunner.com", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }-
API-Details finden Sie unter DisassociateCustomDomain
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie list-auto-scaling-configurations verwendet wird.
- AWS CLI
-
So rufen Sie eine paginierte Liste der Auto-Scaling-Konfigurationen von App Runner ab
Im folgenden Beispiel für
list-auto-scaling-configurationswerden alle Auto-Scaling-Konfigurationen von App Runner in Ihrem AWS-Konto aufgelistet. In jeder Antwort sind bis zu fünf Auto-Scaling-Konfigurationen aufgelistet.AutoScalingConfigurationNameundLatestOnlysind nicht angegeben. Ihre Standardeinstellungen führen dazu, dass die neueste Version aller aktiven Konfigurationen aufgelistet wird.In diesem Beispiel enthält die Antwort zwei Ergebnisse und es gibt keine weiteren, sodass kein
NextTokenzurückgegeben wird.aws apprunner list-auto-scaling-configurations \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "MaxResults": 5 }Ausgabe:
{ "AutoScalingConfigurationSummaryList": [ { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/2/e76562f50d78042e819fead0f59672e6", "AutoScalingConfigurationName": "high-availability", "AutoScalingConfigurationRevision": 2 }, { "AutoScalingConfigurationArn": "arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/low-cost/1/50d7804e7656fead0f59672e62f2e819", "AutoScalingConfigurationName": "low-cost", "AutoScalingConfigurationRevision": 1 } ] }-
API-Details finden Sie unter ListAutoScalingConfigurations
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie list-connections verwendet wird.
- AWS CLI
-
Beispiel 1: So listen Sie alle Verbindungen auf
Im folgenden Beispiel für
list-connectionswerden alle App-Runner-Verbindungen im AWS-Konto aufgelistet.aws apprunner list-connectionsAusgabe:
{ "ConnectionSummaryList": [ { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection", "ConnectionName": "my-github-connection", "Status": "AVAILABLE", "CreatedAt": "2020-11-03T00:32:51Z", "ProviderType": "GITHUB" }, { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-org-connection", "ConnectionName": "my-github-org-connection", "Status": "AVAILABLE", "CreatedAt": "2020-11-03T02:54:17Z", "ProviderType": "GITHUB" } ] }Beispiel 2: So listen Sie eine Verbindung nach Namen auf
Im folgenden Beispiel für
list-connectionswird eine Verbindung nach ihrem Namen aufgelistet.aws apprunner list-connections \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ConnectionName": "my-github-org-connection" }Ausgabe:
{ "ConnectionSummaryList": [ { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-org-connection", "ConnectionName": "my-github-org-connection", "Status": "AVAILABLE", "CreatedAt": "2020-11-03T02:54:17Z", "ProviderType": "GITHUB" } ] }-
API-Details finden Sie unter ListConnections
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie list-operations verwendet wird.
- AWS CLI
-
So listen Sie Operationen auf, die in einem Service ausgeführt wurden
Im folgenden Beispiel für
list-operationswerden alle Operationen aufgelistet, die bisher in einem App-Runner-Service ausgeführt wurden. In diesem Beispiel ist der Service neu und es wurde nur eine einzige Operation des TypsCREATE_SERVICEausgeführt.aws apprunner list-operations \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Ausgabe:
{ "OperationSummaryList": [ { "EndedAt": 1606156217, "Id": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "StartedAt": 1606156014, "Status": "SUCCEEDED", "TargetArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "Type": "CREATE_SERVICE", "UpdatedAt": 1606156217 } ] }-
API-Details finden Sie unter ListOperations
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie list-services verwendet wird.
- AWS CLI
-
So rufen Sie eine paginierte Liste der App-Runner-Services ab
Im folgenden Beispiel für
list-serviceswerden alle App-Runner-Services im AWS-Konto aufgelistet. In jeder Antwort sind bis zu zwei Services aufgeführt. Dieses Beispiel zeigt die erste Anforderung. Die Antwort enthält zwei Ergebnisse und ein Token, das in der nächsten Anforderung verwendet werden kann. Wenn eine nachfolgende Antwort kein Token enthält, wurden alle Services aufgelistet.aws apprunner list-services \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "MaxResults": 2 }Ausgabe:
{ "NextToken": "eyJDdXN0b21lckFjY291bnRJZCI6IjI3MDIwNTQwMjg0NSIsIlNlcnZpY2VTdGF0dXNDb2RlIjoiUFJPVklTSU9OSU5HIiwiSGFzaEtleSI6IjI3MDIwNTQwMjg0NSNhYjhmOTRjZmUyOWE0NjBmYjg3NjBhZmQyZWU4NzU1NSJ9", "ServiceSummaryList": [ { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "Status": "RUNNING" }, { "CreatedAt": "2020-11-06T23:15:30Z", "UpdatedAt": "2020-11-23T13:21:22Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/golang-container-app/ab8f94cfe29a460fb8760afd2ee87555", "ServiceId": "ab8f94cfe29a460fb8760afd2ee87555", "ServiceName": "golang-container-app", "ServiceUrl": "e2m8rrrx33.us-east-1.awsapprunner.com", "Status": "RUNNING" } ] }-
API-Details finden Sie unter ListServices
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie list-tags-for-resource verwendet wird.
- AWS CLI
-
So listen Sie Tags auf, die einem App-Runner-Service zugeordnet sind
Im folgenden Beispiel für
list-tags-for-resourcewerden alle Tags aufgelistet, die einem App-Runner-Service zugeordnet sind.aws apprunner list-tags-for-resource \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ResourceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Ausgabe:
{ "Tags": [ { "Key": "Department", "Value": "Retail" }, { "Key": "CustomerId", "Value": "56439872357912" } ] }-
API-Details finden Sie unter ListTagsForResource
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie pause-service verwendet wird.
- AWS CLI
-
So halten Sie einen Service an
Im folgenden Beispiel für
pause-servicewird ein App-Runner-Service angehalten.aws apprunner pause-service \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Ausgabe:
{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }-
API-Details finden Sie unter PauseService
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie resume-service verwendet wird.
- AWS CLI
-
So nehmen Sie einen Service wieder auf
Im folgenden Beispiel für
resume-servicewird ein App-Runner-Service wieder aufgenommen.aws apprunner resume-service \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Ausgabe:
{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "3 GB" } } }-
API-Details finden Sie unter ResumeService
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie start-deployment verwendet wird.
- AWS CLI
-
So initiieren Sie eine manuelle Bereitstellung
Im folgenden Beispiel für
start-deploymentwird eine manuelle Bereitstellung für einen App-Runner-Service durchgeführt.aws apprunner start-deployment \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa" }Ausgabe:
{ "OperationId": "853a7d5b-fc9f-4730-831b-fd8037ab832a" }-
API-Details finden Sie unter StartDeployment
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie tag-resource verwendet wird.
- AWS CLI
-
So fügen Sie einem App-Runner-Service Tags hinzu
Im folgenden Beispiel für
tag-resourcewerden einem App-Runner-Service zwei Tags hinzugefügt.aws apprunner tag-resource \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ResourceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "Tags": [ { "Key": "Department", "Value": "Retail" }, { "Key": "CustomerId", "Value": "56439872357912" } ] }Mit diesem Befehl wird keine Ausgabe zurückgegeben.
-
API-Details finden Sie unter TagResource
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie untag-resource verwendet wird.
- AWS CLI
-
So entfernen Sie Tags aus einem App-Runner-Service
Im folgenden Beispiel für
untag-resourcewerden zwei Tags aus einem App-Runner-Service entfernt.aws apprunner untag-resource \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ResourceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "TagKeys": [ "Department", "CustomerId" ] }Mit diesem Befehl wird keine Ausgabe zurückgegeben.
-
API-Details finden Sie unter UntagResource
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie update-service verwendet wird.
- AWS CLI
-
So aktualisieren Sie die Speichergröße
Im folgenden Beispiel für
update-servicewird die Speichergröße von Instances (Skalierungseinheiten) eines App-Runner-Service auf 2 048 MiB aktualisiert.Wenn der Aufruf erfolgreich ist, startet App Runner einen asynchronen Aktualisierungsprozess. Die
Service-Struktur, die durch den Aufruf zurückgegeben wird, spiegelt den neuen Speicherwert wider, der durch diesen Aufruf angewendet wird.aws apprunner update-service \ --cli-input-jsonfile://input.jsonInhalt von
input.json:{ "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "InstanceConfiguration": { "Memory": "4 GB" } }Ausgabe:
{ "OperationId": "17fe9f55-7e91-4097-b243-fcabbb69a4cf", "Service": { "CreatedAt": "2020-11-20T19:05:25Z", "UpdatedAt": "2020-11-23T12:41:37Z", "ServiceArn": "arn:aws:apprunner:us-east-1:123456789012:service/python-app/8fe1e10304f84fd2b0df550fe98a71fa", "ServiceId": "8fe1e10304f84fd2b0df550fe98a71fa", "ServiceName": "python-app", "ServiceUrl": "psbqam834h.us-east-1.awsapprunner.com", "SourceConfiguration": { "AuthenticationConfiguration": { "ConnectionArn": "arn:aws:apprunner:us-east-1:123456789012:connection/my-github-connection/e7656250f67242d7819feade6800f59e" }, "AutoDeploymentsEnabled": true, "CodeRepository": { "CodeConfiguration": { "CodeConfigurationValues": { "BuildCommand": "pip install -r requirements.txt", "Port": "8080", "Runtime": "PYTHON_3", "RuntimeEnvironmentVariables": [ { "NAME": "Jane" } ], "StartCommand": "python server.py" }, "ConfigurationSource": "Api" }, "RepositoryUrl": "https://github.com/my-account/python-hello", "SourceCodeVersion": { "Type": "BRANCH", "Value": "main" } } }, "Status": "OPERATION_IN_PROGRESS", "InstanceConfiguration": { "CPU": "1 vCPU", "Memory": "4 GB" } } }-
API-Details finden Sie unter UpdateService
in der AWS CLI-Befehlsreferenz.
-