AppRunner.Client.
create_service
(**kwargs)¶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
Request Syntax
response = client.create_service(
ServiceName='string',
SourceConfiguration={
'CodeRepository': {
'RepositoryUrl': 'string',
'SourceCodeVersion': {
'Type': 'BRANCH',
'Value': 'string'
},
'CodeConfiguration': {
'ConfigurationSource': 'REPOSITORY'|'API',
'CodeConfigurationValues': {
'Runtime': 'PYTHON_3'|'NODEJS_12'|'NODEJS_14'|'CORRETTO_8'|'CORRETTO_11'|'NODEJS_16'|'GO_1'|'DOTNET_6'|'PHP_81'|'RUBY_31',
'BuildCommand': 'string',
'StartCommand': 'string',
'Port': 'string',
'RuntimeEnvironmentVariables': {
'string': 'string'
},
'RuntimeEnvironmentSecrets': {
'string': 'string'
}
}
}
},
'ImageRepository': {
'ImageIdentifier': 'string',
'ImageConfiguration': {
'RuntimeEnvironmentVariables': {
'string': 'string'
},
'StartCommand': 'string',
'Port': 'string',
'RuntimeEnvironmentSecrets': {
'string': 'string'
}
},
'ImageRepositoryType': 'ECR'|'ECR_PUBLIC'
},
'AutoDeploymentsEnabled': True|False,
'AuthenticationConfiguration': {
'ConnectionArn': 'string',
'AccessRoleArn': 'string'
}
},
InstanceConfiguration={
'Cpu': 'string',
'Memory': 'string',
'InstanceRoleArn': 'string'
},
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
EncryptionConfiguration={
'KmsKey': 'string'
},
HealthCheckConfiguration={
'Protocol': 'TCP'|'HTTP',
'Path': 'string',
'Interval': 123,
'Timeout': 123,
'HealthyThreshold': 123,
'UnhealthyThreshold': 123
},
AutoScalingConfigurationArn='string',
NetworkConfiguration={
'EgressConfiguration': {
'EgressType': 'DEFAULT'|'VPC',
'VpcConnectorArn': 'string'
},
'IngressConfiguration': {
'IsPubliclyAccessible': True|False
}
},
ObservabilityConfiguration={
'ObservabilityEnabled': True|False,
'ObservabilityConfigurationArn': 'string'
}
)
[REQUIRED]
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.
[REQUIRED]
The source to deploy to the App Runner service. It can be a code or an image repository.
The description of a source code repository.
You must provide either this member or ImageRepository
(but not both).
The location of the repository that contains the source code.
The version that should be used within the source code repository.
The type of version identifier.
For a git-based repository, branches represent versions.
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.
Configuration for building and running the service from a source code repository.
Note
CodeConfiguration
is required only for CreateService
request.
The source of the App Runner configuration. Values are interpreted as follows:
REPOSITORY
– App Runner reads configuration values from the apprunner.yaml
file in the source code repository and ignores CodeConfigurationValues
.API
– App Runner uses configuration values provided in CodeConfigurationValues
and ignores the apprunner.yaml
file in the source code repository.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).
A runtime environment type for building and running an App Runner service. It represents a programming language runtime.
The command App Runner runs to build your application.
The command App Runner runs to start your application.
The port that your application listens to in the container.
Default: 8080
The environment variables that are available to your running App Runner service. An array of key-value pairs.
An array of key-value pairs representing the secrets and parameters that get referenced to your service as an environment variable. The supported values are either the full Amazon Resource Name (ARN) of the Secrets Manager secret or the full ARN of the parameter in the Amazon Web Services Systems Manager Parameter Store.
Note
The description of a source image repository.
You must provide either this member or CodeRepository
(but not both).
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 .
Configuration for running the identified image.
Environment variables that are available to your running App Runner service. An array of key-value pairs.
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.
The port that your application listens to in the container.
Default: 8080
An array of key-value pairs representing the secrets and parameters that get referenced to your service as an environment variable. The supported values are either the full Amazon Resource Name (ARN) of the Secrets Manager secret or the full ARN of the parameter in the Amazon Web Services Systems Manager Parameter Store.
Note
The type of the image repository. This reflects the repository provider and whether the repository is private or public.
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 to true
in all other cases (which currently include a source code repository or a source image using a same-account ECR repository).
Describes the resources that are needed to authenticate access to some source repositories.
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.
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).
The runtime configuration of instances (scaling units) of your service.
The number of CPU units reserved for each instance of your App Runner service.
Default: 1 vCPU
The amount of memory, in MB or GB, reserved for each instance of your App Runner service.
Default: 2 GB
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.
An optional list of metadata items that you can associate with the App Runner service resource. A tag is a key-value pair.
Describes a tag that is applied to an App Runner resource. A tag is a metadata item consisting of a key-value pair.
The key of the tag.
The value of the tag.
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.
The ARN of the KMS key that's used for encryption.
The settings for the health check that App Runner performs to monitor the health of the App Runner service.
The IP protocol that App Runner uses to perform health checks for your service.
If you set Protocol
to HTTP
, App Runner sends health check requests to the HTTP path specified by Path
.
Default: TCP
The URL that health check requests are sent to.
Path
is only applicable when you setProtocol
toHTTP
.
Default: "/"
The time interval, in seconds, between health checks.
Default: 5
The time, in seconds, to wait for a health check response before deciding it failed.
Default: 2
The number of consecutive checks that must succeed before App Runner decides that the service is healthy.
Default: 1
The number of consecutive checks that must fail before App Runner decides that the service is unhealthy.
Default: 5
The Amazon Resource Name (ARN) of an App Runner automatic scaling configuration resource that you want to associate with your service. If not provided, App Runner associates the latest revision of a default auto scaling configuration.
Specify an ARN with a name and a revision number to associate that revision. For example: arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability/3
Specify just the name to associate the latest revision. For example: arn:aws:apprunner:us-east-1:123456789012:autoscalingconfiguration/high-availability
Configuration settings related to network traffic of the web application that the App Runner service runs.
Network configuration settings for outbound message traffic.
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 by VpcConnectorArn
.
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
.
Network configuration settings for inbound message traffic.
Specifies whether your App Runner service is publicly accessible. To make the service publicly accessible set it to True
. To make the service privately accessible, from only within an Amazon VPC set it to False
.
The observability configuration of your service.
When true
, an observability configuration resource is associated with the service, and an ObservabilityConfigurationArn
is specified.
The Amazon Resource Name (ARN) of the observability configuration that is associated with the service. Specified only when ObservabilityEnabled
is true
.
Specify an ARN with a name and a revision number to associate that revision. For example: arn:aws:apprunner:us-east-1:123456789012:observabilityconfiguration/xray-tracing/3
Specify just the name to associate the latest revision. For example: arn:aws:apprunner:us-east-1:123456789012:observabilityconfiguration/xray-tracing
dict
Response Syntax
{
'Service': {
'ServiceName': 'string',
'ServiceId': 'string',
'ServiceArn': 'string',
'ServiceUrl': 'string',
'CreatedAt': datetime(2015, 1, 1),
'UpdatedAt': datetime(2015, 1, 1),
'DeletedAt': datetime(2015, 1, 1),
'Status': 'CREATE_FAILED'|'RUNNING'|'DELETED'|'DELETE_FAILED'|'PAUSED'|'OPERATION_IN_PROGRESS',
'SourceConfiguration': {
'CodeRepository': {
'RepositoryUrl': 'string',
'SourceCodeVersion': {
'Type': 'BRANCH',
'Value': 'string'
},
'CodeConfiguration': {
'ConfigurationSource': 'REPOSITORY'|'API',
'CodeConfigurationValues': {
'Runtime': 'PYTHON_3'|'NODEJS_12'|'NODEJS_14'|'CORRETTO_8'|'CORRETTO_11'|'NODEJS_16'|'GO_1'|'DOTNET_6'|'PHP_81'|'RUBY_31',
'BuildCommand': 'string',
'StartCommand': 'string',
'Port': 'string',
'RuntimeEnvironmentVariables': {
'string': 'string'
},
'RuntimeEnvironmentSecrets': {
'string': 'string'
}
}
}
},
'ImageRepository': {
'ImageIdentifier': 'string',
'ImageConfiguration': {
'RuntimeEnvironmentVariables': {
'string': 'string'
},
'StartCommand': 'string',
'Port': 'string',
'RuntimeEnvironmentSecrets': {
'string': 'string'
}
},
'ImageRepositoryType': 'ECR'|'ECR_PUBLIC'
},
'AutoDeploymentsEnabled': True|False,
'AuthenticationConfiguration': {
'ConnectionArn': 'string',
'AccessRoleArn': 'string'
}
},
'InstanceConfiguration': {
'Cpu': 'string',
'Memory': 'string',
'InstanceRoleArn': 'string'
},
'EncryptionConfiguration': {
'KmsKey': 'string'
},
'HealthCheckConfiguration': {
'Protocol': 'TCP'|'HTTP',
'Path': 'string',
'Interval': 123,
'Timeout': 123,
'HealthyThreshold': 123,
'UnhealthyThreshold': 123
},
'AutoScalingConfigurationSummary': {
'AutoScalingConfigurationArn': 'string',
'AutoScalingConfigurationName': 'string',
'AutoScalingConfigurationRevision': 123
},
'NetworkConfiguration': {
'EgressConfiguration': {
'EgressType': 'DEFAULT'|'VPC',
'VpcConnectorArn': 'string'
},
'IngressConfiguration': {
'IsPubliclyAccessible': True|False
}
},
'ObservabilityConfiguration': {
'ObservabilityEnabled': True|False,
'ObservabilityConfigurationArn': 'string'
}
},
'OperationId': 'string'
}
Response Structure
(dict) --
Service (dict) --
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 (datetime) --
The time when the App Runner service was created. It's in the Unix time stamp format.
UpdatedAt (datetime) --
The time when the App Runner service was last updated at. It's in the Unix time stamp format.
DeletedAt (datetime) --
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 (dict) --
The source deployed to the App Runner service. It can be a code or an image repository.
CodeRepository (dict) --
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 (dict) --
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 (dict) --
Configuration for building and running the service from a source code repository.
Note
CodeConfiguration
is required only for CreateService
request.
ConfigurationSource (string) --
The source of the App Runner configuration. Values are interpreted as follows:
REPOSITORY
– App Runner reads configuration values from the apprunner.yaml
file in the source code repository and ignores CodeConfigurationValues
.API
– App Runner uses configuration values provided in CodeConfigurationValues
and ignores the apprunner.yaml
file in the source code repository.CodeConfigurationValues (dict) --
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 (dict) --
The environment variables that are available to your running App Runner service. An array of key-value pairs.
RuntimeEnvironmentSecrets (dict) --
An array of key-value pairs representing the secrets and parameters that get referenced to your service as an environment variable. The supported values are either the full Amazon Resource Name (ARN) of the Secrets Manager secret or the full ARN of the parameter in the Amazon Web Services Systems Manager Parameter Store.
Note
ImageRepository (dict) --
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 (dict) --
Configuration for running the identified image.
RuntimeEnvironmentVariables (dict) --
Environment variables that are available to your running App Runner service. An array of key-value pairs.
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
RuntimeEnvironmentSecrets (dict) --
An array of key-value pairs representing the secrets and parameters that get referenced to your service as an environment variable. The supported values are either the full Amazon Resource Name (ARN) of the Secrets Manager secret or the full ARN of the parameter in the Amazon Web Services Systems Manager Parameter Store.
Note
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 to true
in all other cases (which currently include a source code repository or a source image using a same-account ECR repository).
AuthenticationConfiguration (dict) --
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 (dict) --
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 (dict) --
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 (dict) --
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
to HTTP
, App Runner sends health check requests to the HTTP path specified by Path
.
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 (dict) --
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 same AutoScalingConfigurationName
.
NetworkConfiguration (dict) --
Configuration settings related to network traffic of the web application that this service runs.
EgressConfiguration (dict) --
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 by VpcConnectorArn
.
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
.
IngressConfiguration (dict) --
Network configuration settings for inbound message traffic.
IsPubliclyAccessible (boolean) --
Specifies whether your App Runner service is publicly accessible. To make the service publicly accessible set it to True
. To make the service privately accessible, from only within an Amazon VPC set it to False
.
ObservabilityConfiguration (dict) --
The observability configuration of this service.
ObservabilityEnabled (boolean) --
When true
, an observability configuration resource is associated with the service, and an ObservabilityConfigurationArn
is specified.
ObservabilityConfigurationArn (string) --
The Amazon Resource Name (ARN) of the observability configuration that is associated with the service. Specified only when ObservabilityEnabled
is true
.
Specify an ARN with a name and a revision number to associate that revision. For example: arn:aws:apprunner:us-east-1:123456789012:observabilityconfiguration/xray-tracing/3
Specify just the name to associate the latest revision. For example: arn:aws:apprunner:us-east-1:123456789012:observabilityconfiguration/xray-tracing
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.
Exceptions
AppRunner.Client.exceptions.InvalidRequestException
AppRunner.Client.exceptions.InternalServiceErrorException
AppRunner.Client.exceptions.ServiceQuotaExceededException