Managing Private endpoint - AWS App Runner

Managing Private endpoint

Manage the Private endpoint for the incoming traffic using one of the following methods:

Note

If your App Runner application requires source IP/CIDR incoming traffic control rules, you must use security group rules for private endpoints instead of WAF web ACLs. This is because we currently don’t support forwarding request source IP data to App Runner private services associated with WAF. As a result, source IP rules for App Runner private services that are associated with WAF web ACLs do not adhere to IP based rules.

To learn more about infrastructure security and security groups, including best practices, see the following topics in the Amazon VPC User Guide: Control network traffic and Control traffic to your AWS resources using security groups.

App Runner console

When you create a service using the App Runner console, or when you update its configuration later, you can choose to configure the incoming traffic.

To configure your incoming traffic, choose one of the following.

  • Public endpoint: To make your service accessible to all services over the internet. By default, Public endpoint is selected.

  • Private endpoint: To make your App Runner service accessible from only within an Amazon VPC.

Note

Currently, App Runner supports IPv6 only for public endpoints. IPv6 endpoints are not supported for App Runner services hosted in an Amazon Virtual Private Cloud (Amazon VPC). If you udpate a service that's using dual-stack public endpoint to a private endpoint, your App Runner service will default to support traffic from only IPv4 endpoints and fail to receive traffic from IPv6 endpoints.

Enable Private endpoint

Enable a Private endpoint by associating it with VPC interface endpoint of the Amazon VPC you want to access. You can either create a new VPC interface endpoint or choose an existing one.

To create a VPC interface endpoint
  1. Open the App Runner console, and in the Regions list, select your AWS Region.

  2. Go to Networking section under Configure service.

  3. Choose Private endpoint, for Incoming network traffic. Options to connect to a VCP using VPC interface endpoint opens.

  4. Choose Create new endpoint. The Create new VPC interface endpoint dialog-box opens.

  5. Enter a name for VPC interface endpoint.

  6. Choose the required VPC interface endpoint from the available drop-down list.

  7. Choose security group from the drop-down list. Adding security groups provides an additional layer of security to the VPC interface endpoint. It’s recommended to choose two or more security groups. If you don’t choose a security group, App Runner assigns a default security group to the VPC interface endpoint. Ensure that the security group rules don't block the resources that want to communicate with your App Runner service. The security group rules must allow resources that will interact with your App Runner service.

    Note

    If your App Runner application requires source IP/CIDR incoming traffic control rules, you must use security group rules for private endpoints instead of WAF web ACLs. This is because we currently don’t support forwarding request source IP data to App Runner private services associated with WAF. As a result, source IP rules for App Runner private services that are associated with WAF web ACLs do not adhere to IP based rules.

    To learn more about infrastructure security and security groups, including best practices, see the following topics in the Amazon VPC User Guide: Control network traffic and Control traffic to your AWS resources using security groups.

  8. Choose the required subnets from the drop-down list. It is recommended to select at least two subnets for each Availability Zone from which you’ll access the App Runner service.

  9. (Optional) Choose Add new tag and enter the tag key and the tag value.

  10. Choose Create. The Configure service page opens showing the message of successful creation of VPC interface endpoint on the top bar.

To choose an existing VPC interface endpoint
  1. Open the App Runner console, and in the Regions list, select your AWS Region.

  2. Go to Networking section under Configure service.

  3. Choose Private endpoint, for Incoming network traffic. Options to connect to a VPC using VPC interface endpoint opens. A list of available VPC interface endpoints is shown.

  4. Choose the required VPC interface endpoint listed under VPC interface endpoints.

  5. Choose Next to create your service. App Runner enables the Private endpoint.

    Note

    After your service is created you can choose to edit the Security groups and Subnets associated with the VPC interface endpoint, if required.

    To check the details of the Private endpoint, go to your service and expand the Networking section under Configuration tab. It shows details of the VPC and the VPC interface endpoint associated with the Private endpoint.

Update VPC interface endpoint

After your App Runner service is created, you can edit the VPC interface endpoint associated with the Private endpoint.

Note

You cannot update the Endpoint name and the VPC fields.

To update VPC interface endpoint
  1. Open the App Runner console, and in the Regions list, select your AWS Region.

  2. Go to your service and choose Networking configurations on the left panel.

  3. Choose Incoming traffic to view the VPC interface endpoints associated with the respective services.

  4. Choose the VPC interface endpoint you want to edit.

  5. Choose Edit. The dialog-box to edit the VPC interface endpoint opens.

  6. Choose the required Security groups and Subnets and click Update. The page showing the VPC interface endpoint details opens with the message of successful update of the VPC interface endpoint on the top bar.

    Note

    If your App Runner application requires source IP/CIDR incoming traffic control rules, you must use security group rules for private endpoints instead of WAF web ACLs. This is because we currently don’t support forwarding request source IP data to App Runner private services associated with WAF. As a result, source IP rules for App Runner private services that are associated with WAF web ACLs do not adhere to IP based rules.

    To learn more about infrastructure security and security groups, including best practices, see the following topics in the Amazon VPC User Guide: Control network traffic and Control traffic to your AWS resources using security groups.

Delete VPC interface endpoint

If you don’t want your App Runner service to be privately accessible, you can set your incoming traffic to Public. Changing to Public removes the Private endpoint, but it doesn’t delete the VPC interface endpoint

To delete VPC interface endpoint
  1. Open the App Runner console, and in the Regions list, select your AWS Region.

  2. Go to your service and choose Networking configurations on the left panel.

  3. Choose Incoming traffic to view the VPC interface endpoints associated with the respective services.

    Note

    Before deleting a VPC interface endpoint, remove it from all the services its connected to by updating your service.

  4. Choose Delete.

    If there are services connected to VPC interface endpoint, then you receive a Cannot delete VPC interface endpoint message. If there are no services connected to the VPC interface endpoint, you receive a message to confirm the deletion.

  5. Choose Delete. The Network configurations page opens for the Incoming traffic with the message of successful deletion of the VPC interface endpoint on the top bar.

App Runner API or AWS CLI

You can deploy an application on App Runner that is only accessible from within an Amazon VPC.

For information on permissions required to make your service private, see Permissions.

Note

Currently, App Runner supports IPv6 only for public endpoints. IPv6 endpoints are not supported for App Runner services hosted in an Amazon Virtual Private Cloud (Amazon VPC). If you udpate a service that's using dual-stack public endpoint to a private endpoint, your App Runner service will default to support traffic from only IPv4 endpoints and fail to receive traffic from IPv6 endpoints.

To create a private service connection to Amazon VPC
  1. Create a VPC interface endpoint, an AWS PrivateLink resource, to connect to App Runner. To do this, specify subnets and security groups to associate with the application. The following is an example of creating a VPC interface endpoint.

    Note

    If your App Runner application requires source IP/CIDR incoming traffic control rules, you must use security group rules for private endpoints instead of WAF web ACLs. This is because we currently don’t support forwarding request source IP data to App Runner private services associated with WAF. As a result, source IP rules for App Runner private services that are associated with WAF web ACLs do not adhere to IP based rules.

    To learn more about infrastructure security and security groups, including best practices, see the following topics in the Amazon VPC User Guide: Control network traffic and Control traffic to your AWS resources using security groups.

    aws ec2 create-vpc-endpoint --vpc-endpoint-type: Interface --service-name: com.amazonaws.us-east-1.apprunner.requests --subnets: subnet1, subnet2 --security-groups: sg1
  2. Reference the VPC interface endpoint by using the CreateService or UpdateService App Runner API actions through the CLI. Configure your service to not be publically accessible. Set IsPubliclyAccessible to Falsein the IngressConfiguration member of the NetworkConfiguration parameter. The following is an example of referencing VPC interface endpoint.

    aws apprunner create-service --network-configuration: ingress-configuration=<ingress_configuration> --service-name: com.amazonaws.us-east-1.apprunner.requests --source-configuration: <source_configuration> # Ingress Configuration { "IsPubliclyAccessible": False }
  3. Call the create-vpc-ingress-connection API action to create the VPC Ingress Connection resource for App Runner and associate it with the VPC interface endpoint you created in the previous step. It returns a domain name that is used to access your service in the specified VPC. The following is an example of creating a VPC Ingress Connection resource.

    Example Request
    aws apprunner create-vpc-ingress-connection --service-arn: <apprunner_service_arn> --ingress-vpc-configuration: {"VpcId":<vpc_id>, "VpceId": <vpce_id>} --vpc-ingress-connection-name: <vic_connection_name>
    Example Response
    { "VpcIngressConnectionArn": <vpc_ingress_connection_arn>, "VpcIngressConnectionName": <vic_connection_name>, "ServiceArn": <apprunner_service_arn>, "Status": "PENDING_CREATION", "AccountId": <connection_owner_id>, "DomainName": <domain_name_associated_with_vpce>, "IngressVpcConfiguration": {"VpcId":<vpc_id>, "VpceId":<vpce_id>}, "CreatedAt": <date_created> }

Update VPC Ingress Connection

You can update the VPC Ingress Connection resource. The VPC Ingress Connection must be in one of the following states to be updated:

  • AVAILABLE

  • FAILED_CREATION

  • FAILED_UPDATE

The following is an example of updating a VPC Ingress Connection resource.

Example Request
aws apprunner update-vpc-ingress-connection --vpc-ingress-connection-arn: <vpc_ingress_connection_arn>
Example Response
{ "VpcIngressConnectionArn": <vpc_ingress_connection_arn>, "VpcIngressConnectionName": <vic_connection_name>, "ServiceArn": <apprunner_service_arn>, "Status": "FAILED_UPDATE", "AccountId": <connection_owner_id>, "DomainName": <domain_name_associated_with_vpce>, "IngressVpcConfiguration": {"VpcId":<vpc_id>, "VpceId":<vpce_id>}, "CreatedAt": <date_created> }

Delete VPC Ingress Connection

You can delete the VPC Ingress Connection resource if you no longer need the private connection to the Amazon VPC.

The VPC Ingress Connection must be in one of the following states to be deleted:

  • AVAILABLE

  • FAILED CREATION

  • FAILED UPDATE

  • FAILED DELETION

The following is an example of deleting a VPC Ingress Connection

Example Request
aws apprunner delete-vpc-ingress-connection --vpc-ingress-connection-arn: <vpc_ingress_connection_arn>
Example Response
{ "VpcIngressConnectionArn": <vpc_ingress_connection_arn>, "VpcIngressConnectionName": <vic_connection_name>, "ServiceArn": <apprunner_service_arn>, "Status": "PENDING_DELETION", "AccountId": <connection_owner_id>, "DomainName": <domain_name_associated_with_vpce>, "IngressVpcConfiguration": {"VpcId":<vpc_id>, "VpceId":<vpce_id>}, "CreatedAt": <date_created>, "DeletedAt": <date_deleted> }

Use the following App Runner API actions to manage the private inbound traffic for your service.

  • CreateVpcIngressConnection – Create a new VPC Ingress Connection resource. App Runner requires this resource when you want to associate your App Runner service to an Amazon VPC endpoint.

  • ListVpcIngressConnections – Return a list of AWS App Runner VPC Ingress Connection endpoints that are associated with your AWS account.

  • DescribeVpcIngressConnection – Return a full description of AWS App Runner VPC Ingress Connection resource.

  • UpdateVpcIngressConnection – Update the AWS App Runner VPC Ingress Connection resource.

  • DeleteVpcIngressConnection – Delete an App Runner VPC Ingress Connection resource that’s associated with the App Runner service.

For more information on using App Runner API, see App Runner API Reference guide.