Service

class aws_cdk.aws_apprunner.Service(scope, id, *, access_role=None, cpu=None, instance_role=None, memory=None, service_name=None, source)

Bases: aws_cdk.core.Resource

(experimental) The App Runner Service.

Stability

experimental

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_apprunner as apprunner
import aws_cdk.aws_iam as iam

# cpu is of type Cpu
# memory is of type Memory
# role is of type Role
# source is of type Source

service = apprunner.Service(self, "MyService",
    source=source,

    # the properties below are optional
    access_role=role,
    cpu=cpu,
    instance_role=role,
    memory=memory,
    service_name="serviceName"
)
Parameters
  • scope (Construct) –

  • id (str) –

  • access_role (Optional[IRole]) – (experimental) 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). Default: - generate a new access role.

  • cpu (Optional[Cpu]) – (experimental) The number of CPU units reserved for each instance of your App Runner service. Default: Cpu.ONE_VCPU

  • instance_role (Optional[IRole]) – (experimental) The IAM role that provides permissions to your App Runner service. These are permissions that your code needs when it calls any AWS APIs. Default: - no instance role attached.

  • memory (Optional[Memory]) – (experimental) The amount of memory reserved for each instance of your App Runner service. Default: Memory.TWO_GB

  • service_name (Optional[str]) – (experimental) Name of the service. Default: - auto-generated if undefined.

  • source (Source) – (experimental) The source of the repository for the service.

Stability

experimental

Methods

apply_removal_policy(policy)

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters

policy (RemovalPolicy) –

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

Return type

ResourceEnvironment

node

The construct tree node associated with this construct.

Return type

ConstructNode

service_arn

(experimental) The ARN of the Service.

Stability

experimental

Attribute

true

Return type

str

service_id

(experimental) The ID of the Service.

Stability

experimental

Attribute

true

Return type

str

service_name

(experimental) The name of the service.

Stability

experimental

Attribute

true

Return type

str

service_status

(experimental) The status of the Service.

Stability

experimental

Attribute

true

Return type

str

service_url

(experimental) The URL of the Service.

Stability

experimental

Attribute

true

Return type

str

stack

The stack in which this resource is defined.

Return type

Stack

Static Methods

classmethod from_service_attributes(scope, id, *, service_arn, service_name, service_status, service_url)

(experimental) Import from service attributes.

Parameters
  • scope (Construct) –

  • id (str) –

  • service_arn (str) – (experimental) The ARN of the service.

  • service_name (str) – (experimental) The name of the service.

  • service_status (str) – (experimental) The status of the service.

  • service_url (str) – (experimental) The URL of the service.

Stability

experimental

Return type

IService

classmethod from_service_name(scope, id, service_name)

(experimental) Import from service name.

Parameters
  • scope (Construct) –

  • id (str) –

  • service_name (str) –

Stability

experimental

Return type

IService

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters

construct (IConstruct) –

Return type

bool