Create an App Runner service. After the service is created, the action also automatically starts a deployment.
This is an asynchronous operation. On a successful call, you can use the returned OperationId
and the ListOperations call to track the operation’s progress.
See also: AWS API Documentation
See ‘aws help’ for descriptions of global parameters.
create-service
--service-name <value>
--source-configuration <value>
[--instance-configuration <value>]
[--tags <value>]
[--encryption-configuration <value>]
[--health-check-configuration <value>]
[--auto-scaling-configuration-arn <value>]
[--network-configuration <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
--service-name
(string)
A name for the App Runner service. It must be unique across all the running App Runner services in your Amazon Web Services account in the Amazon Web Services Region.
--source-configuration
(structure)
The source to deploy to the App Runner service. It can be a code or an image repository.
CodeRepository -> (structure)
The description of a source code repository.
You must provide either this member or
ImageRepository
(but not both).RepositoryUrl -> (string)
The location of the repository that contains the source code.
SourceCodeVersion -> (structure)
The version that should be used within the source code repository.
Type -> (string)
The type of version identifier.
For a git-based repository, branches represent versions.
Value -> (string)
A source code version.
For a git-based repository, a branch name maps to a specific version. App Runner uses the most recent commit to the branch.
CodeConfiguration -> (structure)
Configuration for building and running the service from a source code repository.
ConfigurationSource -> (string)
The source of the App Runner configuration. Values are interpreted as follows:
REPOSITORY
– App Runner reads configuration values from theapprunner.yaml
file in the source code repository and ignoresCodeConfigurationValues
.
API
– App Runner uses configuration values provided inCodeConfigurationValues
and ignores theapprunner.yaml
file in the source code repository.CodeConfigurationValues -> (structure)
The basic configuration for building and running the App Runner service. Use it to quickly launch an App Runner service without providing a
apprunner.yaml
file in the source code repository (or ignoring the file if it exists).Runtime -> (string)
A runtime environment type for building and running an App Runner service. It represents a programming language runtime.
BuildCommand -> (string)
The command App Runner runs to build your application.
StartCommand -> (string)
The command App Runner runs to start your application.
Port -> (string)
The port that your application listens to in the container.
Default:
8080
RuntimeEnvironmentVariables -> (map)
The environment variables that are available to your running App Runner service. An array of key-value pairs. Keys with a prefix of
AWSAPPRUNNER
are reserved for system use and aren’t valid.key -> (string)
value -> (string)
ImageRepository -> (structure)
The description of a source image repository.
You must provide either this member or
CodeRepository
(but not both).ImageIdentifier -> (string)
The identifier of an image.
For an image in Amazon Elastic Container Registry (Amazon ECR), this is an image name. For the image name format, see Pulling an image in the Amazon ECR User Guide .
ImageConfiguration -> (structure)
Configuration for running the identified image.
RuntimeEnvironmentVariables -> (map)
Environment variables that are available to your running App Runner service. An array of key-value pairs. Keys with a prefix of
AWSAPPRUNNER
are reserved for system use and aren’t valid.key -> (string)
value -> (string)
StartCommand -> (string)
An optional command that App Runner runs to start the application in the source image. If specified, this command overrides the Docker image’s default start command.
Port -> (string)
The port that your application listens to in the container.
Default:
8080
ImageRepositoryType -> (string)
The type of the image repository. This reflects the repository provider and whether the repository is private or public.
AutoDeploymentsEnabled -> (boolean)
If
true
, continuous integration from the source repository is enabled for the App Runner service. Each repository change (including any source code commit or new image version) starts a deployment.Default: App Runner sets to
false
for a source image that uses an ECR Public repository or an ECR repository that’s in an Amazon Web Services account other than the one that the service is in. App Runner sets totrue
in all other cases (which currently include a source code repository or a source image using a same-account ECR repository).AuthenticationConfiguration -> (structure)
Describes the resources that are needed to authenticate access to some source repositories.
ConnectionArn -> (string)
The Amazon Resource Name (ARN) of the App Runner connection that enables the App Runner service to connect to a source repository. It’s required for GitHub code repositories.
AccessRoleArn -> (string)
The Amazon Resource Name (ARN) of the IAM role that grants the App Runner service access to a source repository. It’s required for ECR image repositories (but not for ECR Public repositories).
JSON Syntax:
{
"CodeRepository": {
"RepositoryUrl": "string",
"SourceCodeVersion": {
"Type": "BRANCH",
"Value": "string"
},
"CodeConfiguration": {
"ConfigurationSource": "REPOSITORY"|"API",
"CodeConfigurationValues": {
"Runtime": "PYTHON_3"|"NODEJS_12",
"BuildCommand": "string",
"StartCommand": "string",
"Port": "string",
"RuntimeEnvironmentVariables": {"string": "string"
...}
}
}
},
"ImageRepository": {
"ImageIdentifier": "string",
"ImageConfiguration": {
"RuntimeEnvironmentVariables": {"string": "string"
...},
"StartCommand": "string",
"Port": "string"
},
"ImageRepositoryType": "ECR"|"ECR_PUBLIC"
},
"AutoDeploymentsEnabled": true|false,
"AuthenticationConfiguration": {
"ConnectionArn": "string",
"AccessRoleArn": "string"
}
}
--instance-configuration
(structure)
The runtime configuration of instances (scaling units) of the App Runner service.
Cpu -> (string)
The number of CPU units reserved for each instance of your App Runner service.
Default:
1 vCPU
Memory -> (string)
The amount of memory, in MB or GB, reserved for each instance of your App Runner service.
Default:
2 GB
InstanceRoleArn -> (string)
The Amazon Resource Name (ARN) of an IAM role that provides permissions to your App Runner service. These are permissions that your code needs when it calls any Amazon Web Services APIs.
Shorthand Syntax:
Cpu=string,Memory=string,InstanceRoleArn=string
JSON Syntax:
{
"Cpu": "string",
"Memory": "string",
"InstanceRoleArn": "string"
}
--tags
(list)
An optional list of metadata items that you can associate with the App Runner service resource. A tag is a key-value pair.
(structure)
Describes a tag that is applied to an App Runner resource. A tag is a metadata item consisting of a key-value pair.
Key -> (string)
The key of the tag.
Value -> (string)
The value of the tag.
Shorthand Syntax:
Key=string,Value=string ...
JSON Syntax:
[
{
"Key": "string",
"Value": "string"
}
...
]
--encryption-configuration
(structure)
An optional custom encryption key that App Runner uses to encrypt the copy of your source repository that it maintains and your service logs. By default, App Runner uses an Amazon Web Services managed key.
KmsKey -> (string)
The ARN of the KMS key that’s used for encryption.
Shorthand Syntax:
KmsKey=string
JSON Syntax:
{
"KmsKey": "string"
}
--health-check-configuration
(structure)
The settings for the health check that App Runner performs to monitor the health of the App Runner service.
Protocol -> (string)
The IP protocol that App Runner uses to perform health checks for your service.
If you set
Protocol
toHTTP
, App Runner sends health check requests to the HTTP path specified byPath
.Default:
TCP
Path -> (string)
The URL that health check requests are sent to.
Path
is only applicable when you setProtocol
toHTTP
.Default:
"/"
Interval -> (integer)
The time interval, in seconds, between health checks.
Default:
5
Timeout -> (integer)
The time, in seconds, to wait for a health check response before deciding it failed.
Default:
2
HealthyThreshold -> (integer)
The number of consecutive checks that must succeed before App Runner decides that the service is healthy.
Default:
1
UnhealthyThreshold -> (integer)
The number of consecutive checks that must fail before App Runner decides that the service is unhealthy.
Default:
5
Shorthand Syntax:
Protocol=string,Path=string,Interval=integer,Timeout=integer,HealthyThreshold=integer,UnhealthyThreshold=integer
JSON Syntax:
{
"Protocol": "TCP"|"HTTP",
"Path": "string",
"Interval": integer,
"Timeout": integer,
"HealthyThreshold": integer,
"UnhealthyThreshold": integer
}
--auto-scaling-configuration-arn
(string)
The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want to associate with the App Runner service. If not provided, App Runner associates the latest revision of a default auto scaling configuration.
--network-configuration
(structure)
Configuration settings related to network traffic of the web application that the App Runner service runs.
EgressConfiguration -> (structure)
Network configuration settings for outbound message traffic.
EgressType -> (string)
The type of egress configuration.
Set to
DEFAULT
for access to resources hosted on public networks.Set to
VPC
to associate your service to a custom VPC specified byVpcConnectorArn
.VpcConnectorArn -> (string)
The Amazon Resource Name (ARN) of the App Runner VPC connector that you want to associate with your App Runner service. Only valid when
EgressType = VPC
.
Shorthand Syntax:
EgressConfiguration={EgressType=string,VpcConnectorArn=string}
JSON Syntax:
{
"EgressConfiguration": {
"EgressType": "DEFAULT"|"VPC",
"VpcConnectorArn": "string"
}
}
--cli-input-json
| --cli-input-yaml
(string)
Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton
. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml
.
--generate-cli-skeleton
(string)
Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input
, prints a sample input JSON that can be used as an argument for --cli-input-json
. Similarly, if provided yaml-input
it will print a sample input YAML that can be used with --cli-input-yaml
. If provided with the value output
, it validates the command inputs and returns a sample output JSON for that command.
See ‘aws help’ for descriptions of global parameters.
Example 1: To create a source code repository service
The following create-service
example creates an App Runner service based on a Python source code repository.
aws apprunner create-service \
--cli-input-json file://input.json
Contents of 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"
}
}
Output:
{
"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"
}
}
}
Example 2: To create a source code repository service
The following create-service
example creates an App Runner service based on a Python source code repository.
aws apprunner create-service \
--cli-input-json file://input.json
Contents of 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"
}
}
Output:
{
"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"
}
}
}
Example 3: To create a source image repository service
The following create-service
example creates an App Runner service based on an image stored in Elastic Container Registry (ECR).
aws apprunner create-service \
--cli-input-json file://input.json
Contents of 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"
}
}
Output:
{
"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"
}
}
}
Service -> (structure)
A description of the App Runner service that’s created by this request.
ServiceName -> (string)
The customer-provided service name.
ServiceId -> (string)
An ID that App Runner generated for this service. It’s unique within the Amazon Web Services Region.
ServiceArn -> (string)
The Amazon Resource Name (ARN) of this service.
ServiceUrl -> (string)
A subdomain URL that App Runner generated for this service. You can use this URL to access your service web application.
CreatedAt -> (timestamp)
The time when the App Runner service was created. It’s in the Unix time stamp format.
UpdatedAt -> (timestamp)
The time when the App Runner service was last updated at. It’s in the Unix time stamp format.
DeletedAt -> (timestamp)
The time when the App Runner service was deleted. It’s in the Unix time stamp format.
Status -> (string)
The current state of the App Runner service. These particular values mean the following.
CREATE_FAILED
– The service failed to create. To troubleshoot this failure, read the failure events and logs, change any parameters that need to be fixed, and retry the call to create the service. The failed service isn’t usable, and still counts towards your service quota. When you’re done analyzing the failure, delete the service.
DELETE_FAILED
– The service failed to delete and can’t be successfully recovered. Retry the service deletion call to ensure that all related resources are removed.SourceConfiguration -> (structure)
The source deployed to the App Runner service. It can be a code or an image repository.
CodeRepository -> (structure)
The description of a source code repository.
You must provide either this member or
ImageRepository
(but not both).RepositoryUrl -> (string)
The location of the repository that contains the source code.
SourceCodeVersion -> (structure)
The version that should be used within the source code repository.
Type -> (string)
The type of version identifier.
For a git-based repository, branches represent versions.
Value -> (string)
A source code version.
For a git-based repository, a branch name maps to a specific version. App Runner uses the most recent commit to the branch.
CodeConfiguration -> (structure)
Configuration for building and running the service from a source code repository.
ConfigurationSource -> (string)
The source of the App Runner configuration. Values are interpreted as follows:
REPOSITORY
– App Runner reads configuration values from theapprunner.yaml
file in the source code repository and ignoresCodeConfigurationValues
.
API
– App Runner uses configuration values provided inCodeConfigurationValues
and ignores theapprunner.yaml
file in the source code repository.CodeConfigurationValues -> (structure)
The basic configuration for building and running the App Runner service. Use it to quickly launch an App Runner service without providing a
apprunner.yaml
file in the source code repository (or ignoring the file if it exists).Runtime -> (string)
A runtime environment type for building and running an App Runner service. It represents a programming language runtime.
BuildCommand -> (string)
The command App Runner runs to build your application.
StartCommand -> (string)
The command App Runner runs to start your application.
Port -> (string)
The port that your application listens to in the container.
Default:
8080
RuntimeEnvironmentVariables -> (map)
The environment variables that are available to your running App Runner service. An array of key-value pairs. Keys with a prefix of
AWSAPPRUNNER
are reserved for system use and aren’t valid.key -> (string)
value -> (string)
ImageRepository -> (structure)
The description of a source image repository.
You must provide either this member or
CodeRepository
(but not both).ImageIdentifier -> (string)
The identifier of an image.
For an image in Amazon Elastic Container Registry (Amazon ECR), this is an image name. For the image name format, see Pulling an image in the Amazon ECR User Guide .
ImageConfiguration -> (structure)
Configuration for running the identified image.
RuntimeEnvironmentVariables -> (map)
Environment variables that are available to your running App Runner service. An array of key-value pairs. Keys with a prefix of
AWSAPPRUNNER
are reserved for system use and aren’t valid.key -> (string)
value -> (string)
StartCommand -> (string)
An optional command that App Runner runs to start the application in the source image. If specified, this command overrides the Docker image’s default start command.
Port -> (string)
The port that your application listens to in the container.
Default:
8080
ImageRepositoryType -> (string)
The type of the image repository. This reflects the repository provider and whether the repository is private or public.
AutoDeploymentsEnabled -> (boolean)
If
true
, continuous integration from the source repository is enabled for the App Runner service. Each repository change (including any source code commit or new image version) starts a deployment.Default: App Runner sets to
false
for a source image that uses an ECR Public repository or an ECR repository that’s in an Amazon Web Services account other than the one that the service is in. App Runner sets totrue
in all other cases (which currently include a source code repository or a source image using a same-account ECR repository).AuthenticationConfiguration -> (structure)
Describes the resources that are needed to authenticate access to some source repositories.
ConnectionArn -> (string)
The Amazon Resource Name (ARN) of the App Runner connection that enables the App Runner service to connect to a source repository. It’s required for GitHub code repositories.
AccessRoleArn -> (string)
The Amazon Resource Name (ARN) of the IAM role that grants the App Runner service access to a source repository. It’s required for ECR image repositories (but not for ECR Public repositories).
InstanceConfiguration -> (structure)
The runtime configuration of instances (scaling units) of this service.
Cpu -> (string)
The number of CPU units reserved for each instance of your App Runner service.
Default:
1 vCPU
Memory -> (string)
The amount of memory, in MB or GB, reserved for each instance of your App Runner service.
Default:
2 GB
InstanceRoleArn -> (string)
The Amazon Resource Name (ARN) of an IAM role that provides permissions to your App Runner service. These are permissions that your code needs when it calls any Amazon Web Services APIs.
EncryptionConfiguration -> (structure)
The encryption key that App Runner uses to encrypt the service logs and the copy of the source repository that App Runner maintains for the service. It can be either a customer-provided encryption key or an Amazon Web Services managed key.
KmsKey -> (string)
The ARN of the KMS key that’s used for encryption.
HealthCheckConfiguration -> (structure)
The settings for the health check that App Runner performs to monitor the health of this service.
Protocol -> (string)
The IP protocol that App Runner uses to perform health checks for your service.
If you set
Protocol
toHTTP
, App Runner sends health check requests to the HTTP path specified byPath
.Default:
TCP
Path -> (string)
The URL that health check requests are sent to.
Path
is only applicable when you setProtocol
toHTTP
.Default:
"/"
Interval -> (integer)
The time interval, in seconds, between health checks.
Default:
5
Timeout -> (integer)
The time, in seconds, to wait for a health check response before deciding it failed.
Default:
2
HealthyThreshold -> (integer)
The number of consecutive checks that must succeed before App Runner decides that the service is healthy.
Default:
1
UnhealthyThreshold -> (integer)
The number of consecutive checks that must fail before App Runner decides that the service is unhealthy.
Default:
5
AutoScalingConfigurationSummary -> (structure)
Summary information for the App Runner automatic scaling configuration resource that’s associated with this service.
AutoScalingConfigurationArn -> (string)
The Amazon Resource Name (ARN) of this auto scaling configuration.
AutoScalingConfigurationName -> (string)
The customer-provided auto scaling configuration name. It can be used in multiple revisions of a configuration.
AutoScalingConfigurationRevision -> (integer)
The revision of this auto scaling configuration. It’s unique among all the active configurations (
"Status": "ACTIVE"
) with the sameAutoScalingConfigurationName
.NetworkConfiguration -> (structure)
Configuration settings related to network traffic of the web application that this service runs.
EgressConfiguration -> (structure)
Network configuration settings for outbound message traffic.
EgressType -> (string)
The type of egress configuration.
Set to
DEFAULT
for access to resources hosted on public networks.Set to
VPC
to associate your service to a custom VPC specified byVpcConnectorArn
.VpcConnectorArn -> (string)
The Amazon Resource Name (ARN) of the App Runner VPC connector that you want to associate with your App Runner service. Only valid when
EgressType = VPC
.
OperationId -> (string)
The unique ID of the asynchronous operation that this request started. You can use it combined with the ListOperations call to track the operation’s progress.