Diese Dokumentation bezieht sich AWS CLI nur auf Version 1 von. Dokumentation zu Version 2 von finden Sie im Benutzerhandbuch für Version 2. AWS CLI
Die vorliegende Übersetzung wurde maschinell erstellt. Im Falle eines Konflikts oder eines Widerspruchs zwischen dieser übersetzten Fassung und der englischen Fassung (einschließlich infolge von Verzögerungen bei der Übersetzung) ist die englische Fassung maßgeblich.
App Runner-Beispiele mit AWS CLI
Die folgenden Codebeispiele zeigen Ihnen, wie Sie AWS Command Line Interface mit App Runner Aktionen ausführen und allgemeine Szenarien implementieren.
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 Szenarios anzeigen.
Jedes Beispiel enthält einen Link zum vollständigen Quellcode, in dem Sie Anweisungen zum Einrichten und Ausführen des Codes im Kontext finden.
Themen
Aktionen
Das folgende Codebeispiel zeigt die Verwendungassociate-custom-domain.
- AWS CLI
-
Um einen Domainnamen und die WWW-Subdomain einem Dienst zuzuordnen
Im folgenden
associate-custom-domainBeispiel wird ein benutzerdefinierter Domainname, den Sie steuern, einem App Runner-Dienst zugeordnet. Der Domainname ist die Stammdomainexample.com, einschließlich der Subdomain für Sonderfälle.www.example.comaws 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" }-
Einzelheiten zur API finden Sie AssociateCustomDomain
in AWS CLI der Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungcreate-auto-scaling-configuration.
- AWS CLI
-
So erstellen Sie eine Auto-Scaling-Konfiguration mit hoher Verfügbarkeit
Im folgenden
create-auto-scaling-configurationBeispiel wird eine für Hochverfügbarkeit optimierte Auto Scaling-Konfiguration erstellt, indem der WertMinSizeauf 5 gesetzt wird. Mit dieser Konfiguration versucht App Runner, Ihre Serviceinstanzen auf möglichst viele Availability Zones zu verteilen, je nach AWS Region bis zu fünf.Der Aufruf gibt ein
AutoScalingConfigurationObjekt zurück, bei dem die anderen Einstellungen auf die Standardwerte gesetzt 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 } }-
Einzelheiten zur API finden Sie CreateAutoScalingConfiguration
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungcreate-connection.
- AWS CLI
-
Um eine GitHub Verbindung herzustellen
Das folgende
create-connectionBeispiel stellt eine Verbindung zu einem privaten GitHub Code-Repository her. 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 App Runner-Verbindungen verwalten im AWS App Runner-Entwicklerhandbuch.
-
Einzelheiten zur API finden Sie CreateConnection
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungcreate-service.
- AWS CLI
-
Beispiel 1: Um einen Quellcode-Repository-Service zu erstellen
Im folgenden
create-serviceBeispiel wird ein App Runner-Dienst erstellt, der auf einem Python-Quellcode-Repository basiert.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
create-serviceBeispiel wird ein App Runner-Dienst erstellt, der auf einem Python-Quellcode-Repository basiert.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
create-serviceBeispiel wird ein App Runner-Service erstellt, der auf einem in Elastic Container Registry (ECR) gespeicherten Image basiert.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" } } }-
Einzelheiten zur API finden Sie CreateService
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungdelete-auto-scaling-configuration.
- AWS CLI
-
Beispiel 1: Um die letzte aktive Revision einer Auto Scaling-Konfiguration zu löschen
Im folgenden
delete-auto-scaling-configurationBeispiel wird die letzte aktive Version einer App Runner Auto Scaling-Konfiguration 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. Es wird jetzt jedoch angezeigt
"Latest": false, 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: Um eine bestimmte Revision einer Auto Scaling-Konfiguration zu löschen
Im folgenden
delete-auto-scaling-configurationBeispiel wird eine bestimmte Version einer App Runner Auto Scaling-Konfiguration 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 mehrere Revisionen vorhanden. Die Aktion löscht die Revision.
1aws 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 } }-
Einzelheiten zur API finden Sie DeleteAutoScalingConfiguration
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungdelete-connection.
- AWS CLI
-
Um eine Verbindung zu löschen
Im folgenden
delete-connectionBeispiel wird eine App Runner-Verbindung gelöscht. Der Verbindungsstatus nach einem erfolgreichen Anruf lautetDELETED. Dies 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" } }-
Einzelheiten zur API finden Sie DeleteConnection
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungdelete-service.
- AWS CLI
-
Um einen Dienst zu löschen
Im folgenden
delete-serviceBeispiel wird ein App Runner-Dienst 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" } } }-
Einzelheiten zur API finden Sie DeleteService
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungdescribe-auto-scaling-configuration.
- AWS CLI
-
Beispiel 1: Um die letzte aktive Revision einer Auto Scaling-Konfiguration zu beschreiben
Im folgenden
describe-auto-scaling-configurationBeispiel wird die letzte aktive Version einer App Runner Auto Scaling-Konfiguration beschrieben. 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 die Revision
2(die neueste) beschrieben. Das resultierende Objekt wird angezeigt"Latest": true.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: Um eine bestimmte Version einer Auto Scaling-Konfiguration zu beschreiben
Das folgende
describe-auto-scaling-configurationBeispiel enthält eine Beschreibung einer bestimmten Version einer App Runner Auto Scaling-Konfiguration. 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 wird angezeigt."Latest": falseaws 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 } }-
Einzelheiten zur API finden Sie DescribeAutoScalingConfiguration
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungdescribe-custom-domains.
- AWS CLI
-
Um Beschreibungen von benutzerdefinierten Domainnamen abzurufen, die mit einem Dienst verknüpft sind
Im folgenden
describe-custom-domainsBeispiel werden Beschreibungen und Status der benutzerdefinierten Domainnamen abgerufen, die einem App Runner-Dienst 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" }-
Einzelheiten zur API finden Sie DescribeCustomDomains
unter AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungdescribe-service.
- AWS CLI
-
Um einen Dienst zu beschreiben
Das folgende
describe-serviceBeispiel enthält eine Beschreibung eines App Runner-Dienstes.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" } } }-
Einzelheiten zur API finden Sie DescribeService
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungdisassociate-custom-domain.
- AWS CLI
-
Um einen Domainnamen von einem Dienst zu trennen
Im folgenden
disassociate-custom-domainBeispiel wird die Domainexample.comvon einem App Runner-Dienst getrennt. Durch den Aufruf wird auch die Subdomain getrenntwww.example.com, die zusammen mit der Stammdomain verknüpft 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" }-
Einzelheiten zur API finden Sie DisassociateCustomDomain
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendunglist-auto-scaling-configurations.
- AWS CLI
-
Um eine paginierte Liste der Auto Scaling-Konfigurationen von App Runner zu erhalten
Das folgende
list-auto-scaling-configurationsBeispiel listet alle App Runner Auto Scaling-Konfigurationen in Ihrem AWS Konto auf. In jeder Antwort sind bis zu fünf Auto Scaling-Konfigurationen aufgeführt.AutoScalingConfigurationNameundLatestOnlysind nicht spezifiziert. 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 Ergebnis zurückgegeben
NextTokenwird.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 } ] }-
Einzelheiten zur API finden Sie ListAutoScalingConfigurations
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendunglist-connections.
- AWS CLI
-
Beispiel 1: Um alle Verbindungen aufzulisten
Das folgende
list-connectionsBeispiel listet alle App Runner-Verbindungen im AWS Konto auf.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: Um eine Verbindung nach Namen aufzulisten
Das folgende
list-connectionsBeispiel listet eine Verbindung nach ihrem Namen auf.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" } ] }-
Einzelheiten zur API finden Sie ListConnections
unter AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendunglist-operations.
- AWS CLI
-
Um Operationen aufzulisten, die bei einem Dienst aufgetreten sind
Das folgende
list-operationsBeispiel listet alle Operationen auf, die bisher in einem App Runner-Dienst aufgetreten sind. In diesem Beispiel ist der Dienst neu und esCREATE_SERVICEwurde nur ein einziger Vorgang des Typs ausgefü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 } ] }-
Einzelheiten zur API finden Sie ListOperations
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendunglist-services.
- AWS CLI
-
Um eine paginierte Liste der App Runner-Dienste zu erhalten
Das folgende
list-servicesBeispiel listet alle App Runner-Dienste im AWS Konto auf. In jeder Antwort sind bis zu zwei Dienste aufgeführt. Dieses Beispiel zeigt die erste Anfrage. Die Antwort enthält zwei Ergebnisse und ein Token, das in der nächsten Anfrage verwendet werden kann. Wenn eine nachfolgende Antwort kein Token enthält, wurden alle Dienste 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" } ] }-
Einzelheiten zur API finden Sie ListServices
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendunglist-tags-for-resource.
- AWS CLI
-
Um Tags aufzulisten, die einem App Runner-Dienst zugeordnet sind
Das folgende
list-tags-for-resourceBeispiel listet alle Tags auf, die einem App Runner-Dienst 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" } ] }-
Einzelheiten zur API finden Sie ListTagsForResource
unter AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungpause-service.
- AWS CLI
-
Um einen Dienst anzuhalten
Im folgenden
pause-serviceBeispiel wird ein App Runner-Dienst 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" } } }-
Einzelheiten zur API finden Sie PauseService
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungresume-service.
- AWS CLI
-
Um einen Dienst wieder aufzunehmen
Im folgenden
resume-serviceBeispiel wird ein App Runner-Dienst 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" } } }-
Einzelheiten zur API finden Sie ResumeService
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungstart-deployment.
- AWS CLI
-
Um eine manuelle Bereitstellung zu initiieren
Im folgenden
start-deploymentBeispiel wird eine manuelle Bereitstellung für einen App Runner-Dienst 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" }-
Einzelheiten zur API finden Sie StartDeployment
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungtag-resource.
- AWS CLI
-
Um einem App Runner-Dienst Tags hinzuzufügen
Das folgende
tag-resourceBeispiel fügt einem App Runner-Dienst zwei Tags hinzu.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.
-
Einzelheiten zur API finden Sie TagResource
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendunguntag-resource.
- AWS CLI
-
Um Tags aus einem App Runner-Dienst zu entfernen
Im folgenden
untag-resourceBeispiel werden zwei Tags aus einem App Runner-Dienst 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.
-
Einzelheiten zur API finden Sie UntagResource
in der AWS CLI Befehlsreferenz.
-
Das folgende Codebeispiel zeigt die Verwendungupdate-service.
- AWS CLI
-
Um die Speichergröße zu aktualisieren
Im folgenden
update-serviceBeispiel wird die Speichergröße von Instanzen (Skalierungseinheiten) eines App Runner-Dienstes auf 2048 MiB aktualisiert.Wenn der Aufruf erfolgreich ist, startet App Runner einen asynchronen Aktualisierungsprozess. Die
ServiceStruktur, 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" } } }-
Einzelheiten zur API finden Sie UpdateService
in der AWS CLI Befehlsreferenz.
-