Creating App Runner services
You can create an App Runner service in Toolkit for VS Code by using the AWS Explorer and VS Code's Command Palette. After you choose to create a service in a specific AWS Region, numbered steps provided by the Command Palette guide you through the process of configuring the service instance where your application runs.
Before creating an App Runner service, make sure that you've completed the prerequisites. This includes providing the relevant IAM permissions and confirming the specific source repository that you want to deploy.
To create an App Runner service
-
Open AWS Explorer, if it isn't already open.
-
Right-click the App Runner node and choose Create Service.
The Command Palette displays.
-
For Select a source code location type, choose ECR or Repository.
If you choose ECR, you specify a container image in a repository maintained by Amazon Elastic Container Registry. If you choose Repository, you specify a source code repository that's maintained by a supported repository provider. Currently, App Runner supports GitHub
as a source code repository provider.
-
For Select or enter an image repository, choose or enter the URL of the image repository that's maintained by your Amazon ECR private registry or the Amazon ECR Public Gallery.
Note
If you specify a repository from the Amazon ECR Public Gallery, make sure that automatic deployments are turned off because App Runner doesn't support automatic deployments for an image in an ECR Public repository.
Automatic deployments are switched off by default, and this is indicated when the icon on the Command Palette header features a diagonal line through it. If you chose to switch on automatic deployments, a message informs you that this option can incur additional costs.
-
If the Command Palette step reports that No tags found, you need to go back a step to select a repository that contains a tagged container image.
-
If you're using an Amazon ECR private registry, you require the ECR access role, AppRunnerECRAccessRole, that allows App Runner to access Amazon Elastic Container Registry (Amazon ECR) images in your account. Choose the "+" icon on the Command Palette header to automatically create this role. (An access role isn't required if your image is stored in Amazon ECR Public, where images are publicly available.)
-
For Port, enter the IP port that's used by the service (Port
8000
, for example). -
For Configure environment variables, you can specify a file that contains environment variables that are used to customize behavior in your service instance. Or you can skip this step.
-
For Name your service, enter a unique name without spaces and press Enter.
-
For Select instance configuration, choose a combination of CPU units and memory in GB for your service instance.
When your service is being created, its status changes from Creating to Running.
-
After your service starts running, right-click it and choose Copy Service URL.
-
To access your deployed application, paste the copied URL into the address bar of your web browser.
-
For Select a connection, choose a connection that links GitHub to AWS. The connections that are available for selection are listed on the GitHub connections page on the App Runner console.
-
For Select a remote GitHub repository, choose or enter a URL for the remote repository.
Remote repositories that are already configured with Visual Studio Code's source control management (SCM) are available for selection. You can also paste a link to the repository if it's not listed.
-
For Select a branch, choose which Git branch of your source code that you want to deploy.
-
For Choose configuration source, specify how you want to define your runtime configuration.
If you choose Use configuration file, your service instance is configured by settings that are defined by the
apprunner.yaml
configuration file. This file is in the root directory of your application’s repository.If you choose Configure all settings here, use the Command palette to specify the following:
-
Runtime: Choose Python 3 or Nodejs 12.
-
Build command: Enter the command to build your application in the runtime environment of your service instance.
-
Start command: Enter the command to start your application in the runtime environment of your service instance.
-
-
For Port, enter the IP port that's used by the service (Port
8000
, for example). -
For Configure environment variables, you can specify a file that contains environment variables that are used to customize behavior in your service instance. Or you can skip this step.
-
For Name your service, enter a unique name without spaces and press Enter.
-
For Select instance configuration, choose a combination of CPU units and memory in GB for your service instance.
When your service is being created, its status changes from Creating to Running.
-
After your service starts running, right-click it and choose Copy Service URL.
-
To access your deployed application, paste the copied URL into the address bar of your web browser.
Note
If your attempt to create an App Runner service fails, the service shows a status of Create failed in AWS Explorer. For troubleshooting tips, see When service creation fails in the App Runner Developer Guide.