Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Latest commit

 

History

History
1740 lines (1027 loc) · 41.8 KB

API.md

File metadata and controls

1740 lines (1027 loc) · 41.8 KB

API Reference

Constructs

BaseFargateService

Initializers

import { BaseFargateService } from 'cdk-fargate-patterns'

new BaseFargateService(scope: Construct, id: string, props: BaseFargateServiceProps)
scopeRequired

idRequired
  • Type: string

propsRequired

Properties

serviceRequired
public readonly service: FargateService[];

The service(s) created from the task(s).


vpcRequired
public readonly vpc: IVpc;

The VPC.


Database

Represents the database instance or database cluster.

Initializers

import { Database } from 'cdk-fargate-patterns'

new Database(scope: Construct, id: string, props: DatabaseProps)
scopeRequired

idRequired
  • Type: string

propsRequired

Properties

clusterEndpointHostnameRequired
public readonly clusterEndpointHostname: string;
  • Type: string

clusterIdentifierRequired
public readonly clusterIdentifier: string;
  • Type: string

connectionsRequired
public readonly connections: Connections;

secretRequired
public readonly secret: ISecret;

vpcRequired
public readonly vpc: IVpc;

DualAlbFargateService

Initializers

import { DualAlbFargateService } from 'cdk-fargate-patterns'

new DualAlbFargateService(scope: Construct, id: string, props: DualAlbFargateServiceProps)
scopeRequired

idRequired
  • Type: string

propsRequired

Properties

externalAlbOptional
public readonly externalAlb: ApplicationLoadBalancer;

The external ALB.


internalAlbOptional
public readonly internalAlb: ApplicationLoadBalancer;

The internal ALB.


DualNlbFargateService

Initializers

import { DualNlbFargateService } from 'cdk-fargate-patterns'

new DualNlbFargateService(scope: Construct, id: string, props: DualNlbFargateServiceProps)
scopeRequired

idRequired
  • Type: string

propsRequired

Properties

externalNlbOptional
public readonly externalNlb: NetworkLoadBalancer;

The external Nlb.


internalNlbOptional
public readonly internalNlb: NetworkLoadBalancer;

The internal Nlb.


Laravel

Represents the Laravel service.

Initializers

import { Laravel } from 'cdk-fargate-patterns'

new Laravel(scope: Construct, id: string, props: LaravelProps)
scopeRequired

idRequired
  • Type: string

propsRequired

Properties

svcRequired
public readonly svc: DualAlbFargateService;

vpcRequired
public readonly vpc: IVpc;

dbOptional
public readonly db: Database;

WordPress

Initializers

import { WordPress } from 'cdk-fargate-patterns'

new WordPress(scope: Construct, id: string, props?: WordPressProps)
scopeRequired

idRequired
  • Type: string

propsOptional

Properties

svcRequired
public readonly svc: DualAlbFargateService;

vpcRequired
public readonly vpc: IVpc;

dbOptional
public readonly db: Database;

Structs

BaseFargateServiceProps

Initializer

import { BaseFargateServiceProps } from 'cdk-fargate-patterns'

const baseFargateServiceProps: BaseFargateServiceProps = { ... }
tasksRequired
public readonly tasks: FargateTaskProps[];

circuitBreakerOptional
public readonly circuitBreaker: boolean;
  • Type: boolean
  • Default: true

Enable the ECS service circuit breaker.


clusterOptional
public readonly cluster: ICluster;

Use existing ECS Cluster.


clusterPropsOptional
public readonly clusterProps: ClusterProps;

The properties used to define an ECS cluster.


enableExecuteCommandOptional
public readonly enableExecuteCommand: boolean;
  • Type: boolean
  • Default: false

Whether to enable ECS Exec support.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html


route53OpsOptional
public readonly route53Ops: Route53Options;

spotOptional
public readonly spot: boolean;
  • Type: boolean
  • Default: false

create a FARGATE_SPOT only cluster.


spotTerminationHandlerOptional
public readonly spotTerminationHandler: boolean;
  • Type: boolean
  • Default: true

Enable the fargate spot termination handler.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-capacity-providers.html#fargate-capacity-providers-termination


vpcOptional
public readonly vpc: IVpc;

vpcSubnetsOptional
public readonly vpcSubnets: SubnetSelection;

The subnets to associate with the service.


DatabaseCofig

Database configuration.

Initializer

import { DatabaseCofig } from 'cdk-fargate-patterns'

const databaseCofig: DatabaseCofig = { ... }
connectionsRequired
public readonly connections: Connections;

The database connnections.


endpointRequired
public readonly endpoint: string;
  • Type: string

The endpoint address for the database.


identifierRequired
public readonly identifier: string;
  • Type: string

The databasae identifier.


secretRequired
public readonly secret: ISecret;

The database secret.


DatabaseProps

Initializer

import { DatabaseProps } from 'cdk-fargate-patterns'

const databaseProps: DatabaseProps = { ... }
vpcRequired
public readonly vpc: IVpc;

The VPC for the database.


allowFromOptional
public readonly allowFrom: IConnectable;

Allow database connection.


auroraServerlessOptional
public readonly auroraServerless: boolean;
  • Type: boolean
  • Default: false

enable aurora serverless.


backupRetentionOptional
public readonly backupRetention: Duration;

database backup retension.


clusterEngineOptional
public readonly clusterEngine: IClusterEngine;

The database cluster engine.


databaseSubnetsOptional
public readonly databaseSubnets: SubnetSelection;

VPC subnets for database.


defaultDatabaseNameOptional
public readonly defaultDatabaseName: string;
  • Type: string
  • Default: do not create any default database

Default database name to create.


instanceEngineOptional
public readonly instanceEngine: IInstanceEngine;

The database instance engine.


instanceTypeOptional
public readonly instanceType: InstanceType;

The database instance type.


singleDbInstanceOptional
public readonly singleDbInstance: boolean;
  • Type: boolean
  • Default: false

Whether to use single RDS instance rather than RDS cluster.

Not recommended for production.


DualAlbFargateServiceProps

Initializer

import { DualAlbFargateServiceProps } from 'cdk-fargate-patterns'

const dualAlbFargateServiceProps: DualAlbFargateServiceProps = { ... }
tasksRequired
public readonly tasks: FargateTaskProps[];

circuitBreakerOptional
public readonly circuitBreaker: boolean;
  • Type: boolean
  • Default: true

Enable the ECS service circuit breaker.


clusterOptional
public readonly cluster: ICluster;

Use existing ECS Cluster.


clusterPropsOptional
public readonly clusterProps: ClusterProps;

The properties used to define an ECS cluster.


enableExecuteCommandOptional
public readonly enableExecuteCommand: boolean;
  • Type: boolean
  • Default: false

Whether to enable ECS Exec support.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html


route53OpsOptional
public readonly route53Ops: Route53Options;

spotOptional
public readonly spot: boolean;
  • Type: boolean
  • Default: false

create a FARGATE_SPOT only cluster.


spotTerminationHandlerOptional
public readonly spotTerminationHandler: boolean;
  • Type: boolean
  • Default: true

Enable the fargate spot termination handler.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-capacity-providers.html#fargate-capacity-providers-termination


vpcOptional
public readonly vpc: IVpc;

vpcSubnetsOptional
public readonly vpcSubnets: SubnetSelection;

The subnets to associate with the service.


externalAlbIdleTimeoutOptional
public readonly externalAlbIdleTimeout: Duration;

The external load balancer idle timeout, in seconds.


internalAlbIdleTimeoutOptional
public readonly internalAlbIdleTimeout: Duration;

The internal load balancer idle timeout, in seconds.


DualNlbFargateServiceProps

Initializer

import { DualNlbFargateServiceProps } from 'cdk-fargate-patterns'

const dualNlbFargateServiceProps: DualNlbFargateServiceProps = { ... }
tasksRequired
public readonly tasks: FargateTaskProps[];

circuitBreakerOptional
public readonly circuitBreaker: boolean;
  • Type: boolean
  • Default: true

Enable the ECS service circuit breaker.


clusterOptional
public readonly cluster: ICluster;

Use existing ECS Cluster.


clusterPropsOptional
public readonly clusterProps: ClusterProps;

The properties used to define an ECS cluster.


enableExecuteCommandOptional
public readonly enableExecuteCommand: boolean;
  • Type: boolean
  • Default: false

Whether to enable ECS Exec support.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html


route53OpsOptional
public readonly route53Ops: Route53Options;

spotOptional
public readonly spot: boolean;
  • Type: boolean
  • Default: false

create a FARGATE_SPOT only cluster.


spotTerminationHandlerOptional
public readonly spotTerminationHandler: boolean;
  • Type: boolean
  • Default: true

Enable the fargate spot termination handler.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/fargate-capacity-providers.html#fargate-capacity-providers-termination


vpcOptional
public readonly vpc: IVpc;

vpcSubnetsOptional
public readonly vpcSubnets: SubnetSelection;

The subnets to associate with the service.


FargateTaskProps

Task properties for the Fargate.

Initializer

import { FargateTaskProps } from 'cdk-fargate-patterns'

const fargateTaskProps: FargateTaskProps = { ... }
taskRequired
public readonly task: FargateTaskDefinition;

capacityProviderStrategyOptional
public readonly capacityProviderStrategy: CapacityProviderStrategy[];

Customized capacity provider strategy.


desiredCountOptional
public readonly desiredCount: number;
  • Type: number
  • Default: 1

desired number of tasks for the service.


externalOptional
public readonly external: LoadBalancerAccessibility;

The external ELB listener.


healthCheckOptional
public readonly healthCheck: HealthCheck;

health check from elbv2 target group.


healthCheckGracePeriodOptional
public readonly healthCheckGracePeriod: Duration;

The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy Elastic Load Balancing target health checks after a task has first started.


internalOptional
public readonly internal: LoadBalancerAccessibility;

The internal ELB listener.


maxHealthyPercentOptional
public readonly maxHealthyPercent: number;
  • Type: number
  • Default: 200

The maximum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that can run in a service during a deployment.


minHealthyPercentOptional
public readonly minHealthyPercent: number;
  • Type: number
  • Default: 50

The minimum number of tasks, specified as a percentage of the Amazon ECS service's DesiredCount value, that must continue to run and remain healthy during a deployment.


protocolOptional
public readonly protocol: Protocol;

The target group protocol for NLB.

For ALB, this option will be ignored and always set to HTTP.


protocolVersionOptional
public readonly protocolVersion: ApplicationProtocolVersion;

The protocol version to use.


scalingPolicyOptional
public readonly scalingPolicy: ServiceScalingPolicy;

service autoscaling policy.


serviceNameOptional
public readonly serviceName: string;
  • Type: string
  • Default: auto-generated

The serviceName.


LaravelProps

Initializer

import { LaravelProps } from 'cdk-fargate-patterns'

const laravelProps: LaravelProps = { ... }
codeRequired
public readonly code: string;
  • Type: string

The local path to the Laravel code base.


loadbalancerRequired
public readonly loadbalancer: LoadBalancerAccessibility;

The loadbalancer accessibility for the service.


auroraServerlessOptional
public readonly auroraServerless: boolean;
  • Type: boolean
  • Default: false

Whether to use aurora serverless.

When enabled, the databaseInstanceType and engine will be ignored. The rds.DatabaseClusterEngine.AURORA_MYSQL will be used as the default cluster engine instead.


backupRetentionOptional
public readonly backupRetention: Duration;

database backup retension.


clusterEngineOptional
public readonly clusterEngine: IClusterEngine;

The database cluster engine.


containerPortOptional
public readonly containerPort: number;
  • Type: number
  • Default: 80

The Laravel container port.


databaseInstanceTypeOptional
public readonly databaseInstanceType: InstanceType;

Database instance type.


databaseSubnetsOptional
public readonly databaseSubnets: SubnetSelection;

VPC subnets for database.


defaultDatabaseNameOptional
public readonly defaultDatabaseName: string;
  • Type: string

The default database name to create.


efsFileSystemOptional
public readonly efsFileSystem: FileSystemProps;

Options to create the EFS FileSystem.


enableExecuteCommandOptional
public readonly enableExecuteCommand: boolean;
  • Type: boolean

enable ECS Exec.


instanceEngineOptional
public readonly instanceEngine: IInstanceEngine;

The database instance engine.


servicePropsOptional
public readonly serviceProps: FargateTaskProps;

task options for the Laravel fargate service.


singleDbInstanceOptional
public readonly singleDbInstance: boolean;
  • Type: boolean
  • Default: false

Whether to use single RDS instance rather than RDS cluster.

Not recommended for production.


spotOptional
public readonly spot: boolean;
  • Type: boolean

enable fargate spot.


vpcOptional
public readonly vpc: IVpc;

LoadBalancerAccessibility

The load balancer accessibility.

Initializer

import { LoadBalancerAccessibility } from 'cdk-fargate-patterns'

const loadBalancerAccessibility: LoadBalancerAccessibility = { ... }
portRequired
public readonly port: number;
  • Type: number

The port of the listener.


certificateOptional
public readonly certificate: ICertificate[];

The ACM certificate for the HTTPS listener.


forwardConditionsOptional
public readonly forwardConditions: ListenerCondition[];

Listener forward conditions.


Route53Options

Initializer

import { Route53Options } from 'cdk-fargate-patterns'

const route53Options: Route53Options = { ... }
enableLoadBalancerAliasOptional
public readonly enableLoadBalancerAlias: boolean;
  • Type: boolean
  • Default: true

Whether to configure the ALIAS for the LB.


externalElbRecordNameOptional
public readonly externalElbRecordName: string;
  • Type: string
  • Default: external

the external ELB record name.


internalElbRecordNameOptional
public readonly internalElbRecordName: string;
  • Type: string
  • Default: internal

the internal ELB record name.


zoneNameOptional
public readonly zoneName: string;
  • Type: string
  • Default: svc.local

private zone name.


ServiceScalingPolicy

Initializer

import { ServiceScalingPolicy } from 'cdk-fargate-patterns'

const serviceScalingPolicy: ServiceScalingPolicy = { ... }
maxCapacityOptional
public readonly maxCapacity: number;
  • Type: number
  • Default: 10

max capacity for the service autoscaling.


requestPerTargetOptional
public readonly requestPerTarget: number;
  • Type: number
  • Default: 1000

request per target.


targetCpuUtilizationOptional
public readonly targetCpuUtilization: number;
  • Type: number
  • Default: 50

target cpu utilization.


WordPressProps

Initializer

import { WordPressProps } from 'cdk-fargate-patterns'

const wordPressProps: WordPressProps = { ... }
auroraServerlessOptional
public readonly auroraServerless: boolean;
  • Type: boolean
  • Default: false

Whether to use aurora serverless.

When enabled, the databaseInstanceType and engine will be ignored. The rds.DatabaseClusterEngine.AURORA_MYSQL will be used as the default cluster engine instead.


backupRetentionOptional
public readonly backupRetention: Duration;

database backup retension.


clusterEngineOptional
public readonly clusterEngine: IClusterEngine;

The database cluster engine.


databaseInstanceTypeOptional
public readonly databaseInstanceType: InstanceType;

Database instance type.


databaseSubnetsOptional
public readonly databaseSubnets: SubnetSelection;

VPC subnets for database.


enableExecuteCommandOptional
public readonly enableExecuteCommand: boolean;
  • Type: boolean

enable ECS Exec.


instanceEngineOptional
public readonly instanceEngine: IInstanceEngine;

The database instance engine.


servicePropsOptional
public readonly serviceProps: FargateTaskProps;

task options for the WordPress fargate service.


singleDbInstanceOptional
public readonly singleDbInstance: boolean;
  • Type: boolean
  • Default: false

Whether to use single RDS instance rather than RDS cluster.

Not recommended for production.


spotOptional
public readonly spot: boolean;
  • Type: boolean

enable fargate spot.


vpcOptional
public readonly vpc: IVpc;