import * as ec2 from '@aws-cdk/aws-ec2'; import * as ecs from '@aws-cdk/aws-ecs'; import * as elbv2 from '@aws-cdk/aws-elasticloadbalancingv2'; import * as cdk from '@aws-cdk/core'; /** * Fargate Task Definition Properties. * * @stability stable */ export interface RioFargateServiceProps { /** * The stage of the service, e.g. 'prod'. * * @stability stable */ readonly stage: string; /** * The Name of the service. * * @stability stable */ readonly serviceName: string; /** * The version of the service, e.g. the git hash of the corresponding commit. * * @stability stable */ readonly version: string; /** * The frameworks in uses. * * @default - No frameworks. * @stability stable */ readonly frameworks?: Framework[]; /** * The VPC of the service. * * @stability stable */ readonly vpc: ec2.IVpc; /** * Container definition options like image, cpu, memory. * * @stability stable */ readonly containerDefinitionOption: ContainerDefinitionOptions; /** * Fargate Task Definition Properties. * * @stability stable */ readonly fargateOptions: FargateTaskDefinitionProps; /** * Loadbalancer options. * * @stability stable */ readonly loadBalancerOptions?: LoadBalancerOptions; /** * Datadog integration properties. * * @stability stable */ readonly datadogOptions?: DatadogIntegrationProps; } export declare enum Framework { /** * @stability stable */ SPRING = 0 } /** * @stability stable */ export interface ContainerDefinitionOptions { /** * The image used to start a container. * * This string is passed directly to the Docker daemon. * Images in the Docker Hub registry are available by default. * Other repositories are specified with either repository-url/image:tag or repository-url/image@digest. * * @stability stable */ readonly image: ecs.ContainerImage; /** * The environment variables to pass to the container. * * Environment variables set by default are overwritten if passed. * * The default environment variables set are * * DD_ENV: Set same as prop stage * * DD_SERVICE: Set same as prop serviceName * * DD_VERSION: Set same as prop version * * DD_LOGS_INJECTION: true * * DD_SERVICE_MAPPING: database:fargate-web-app-aurora,java-aws-sdk:fargate-web-app-aws-sdk,kafka:fargate-web-app-kafka,mysql:fargate-web-app-aurora * * DD_TAGS: env:prod,service:fargate-web-app,version:notag,account_id:${accountID},account_name:${accountName},region:${AWSRegion},team:${teamName from ssm param /config/team/name} * * DD_TRACE_SAMPLE_RATE: 1.0 * * @default - No environment variables. * @stability stable */ readonly environment?: { [key: string]: string; }; /** * The secret environment variables to pass to the container. * * @default - No secret environment variables. * @stability stable */ readonly secrets?: { [key: string]: ecs.Secret; }; /** * The health check command and associated configuration parameters for the container. * * @default - Health check configuration from container. * @stability stable */ readonly healthCheck?: ecs.HealthCheck; } /** * @stability stable */ export interface FargateTaskDefinitionProps { /** * The number of cpu units used by the task. * * For tasks using the Fargate launch type, * this field is required and you must use one of the following values, * which determines your range of valid values for the memory parameter: * * 256 (.25 vCPU) - Available memory values: 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) * * 512 (.5 vCPU) - Available memory values: 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) * * 1024 (1 vCPU) - Available memory values: 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) * * 2048 (2 vCPU) - Available memory values: Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) * * 4096 (4 vCPU) - Available memory values: Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) * * @default 512 * @stability stable */ readonly cpu: number; /** * The amount (in MiB) of memory used by the task. * * For tasks using the Fargate launch type, * this field is required and you must use one of the following values, which determines your range of valid values for the cpu parameter: * * 512 (0.5 GB), 1024 (1 GB), 2048 (2 GB) - Available cpu values: 256 (.25 vCPU) * * 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4 GB) - Available cpu values: 512 (.5 vCPU) * * 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5 GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB) - Available cpu values: 1024 (1 vCPU) * * Between 4096 (4 GB) and 16384 (16 GB) in increments of 1024 (1 GB) - Available cpu values: 2048 (2 vCPU) * * Between 8192 (8 GB) and 30720 (30 GB) in increments of 1024 (1 GB) - Available cpu values: 4096 (4 vCPU) * * @default 1024 * @stability stable */ readonly memoryLimitMiB: number; /** * Desired count of running tasks. * * @default - When creating the service, default is 1; when updating the service, default uses * the current task number. * @stability stable */ readonly desiredCount?: number; } /** * @stability stable */ export interface ListenerRule { /** * @stability stable */ readonly priority: number; /** * @stability stable */ readonly conditions: elbv2.ListenerCondition[]; } /** * @stability stable */ export interface LoadBalancerOptions { /** * Listener for an Application Load Balancer. * * @stability stable */ readonly listener: elbv2.IApplicationListener; /** * One or more path patterns to compare against the request URL. * * The maximum size of each string is 128 characters. * The comparison is case sensitive. * The following wildcard characters are supported: * (matches 0 or more characters) and ? (matches exactly 1 character). * * Update requires: No interruption * * @stability stable */ readonly listenerRules: ListenerRule[]; /** * Health check options. * * @stability stable */ readonly healthCheck: elbv2.HealthCheck; /** * Health check grace period. * * @stability stable */ readonly healthCheckGracePeriod: cdk.Duration; /** * The time period during which the load balancer sends a newly registered target a linearly increasing share of the traffic to the target group. * * The range is 30-900 seconds (15 minutes). * * @default undefined * @stability stable */ readonly slowStart?: cdk.Duration; /** * The amount of time for Elastic Load Balancing to wait before deregistering a target. * * The range is 0-3600 seconds. * * @default 5 * @stability stable */ readonly deregistrationDelay?: cdk.Duration; } /** * @stability stable */ export interface DatadogIntegrationProps { /** * The minimum number of CPU units to reserve for the container. * * @default - 64 * @stability stable */ readonly cpu?: number; /** * The amount (in MiB) of memory to present to the container. * * If your container attempts to exceed the allocated memory, the container * is terminated. * * At least one of memoryLimitMiB and memoryReservationMiB is required for non-Fargate services. * * @default - 128 * @stability stable */ readonly memoryLimitMiB?: number; /** * The logging mode for the service. * * @default - Using the Datadog log forwarder lambda provided by the datadog-integration. * @stability stable */ readonly loggingModeForService?: DataDogLoggingMode; /** * The logging mode for the Datadog agent sidecar. * * @default - No logs in Datadog, Cloudwatch only. * @stability stable */ readonly loggingModeForDatadogAgent?: DataDogLoggingMode; /** * GET endpoints to ignore in Datadog's APM overview. * * This is useful to filter out all health check calls. * * @default - No endpoints are ignored. * @stability stable */ readonly apmGetEndpointsToIgnore?: string[]; /** * Configure if the Datadog agent sidecar is marked as essential. * * @default - true. * @stability stable */ readonly datadogSidecarEssential?: boolean; /** * Configures the docker image tag for datadog sidecar. * * @default - 'latest' * @stability stable */ readonly datadogSidecarTag?: string; } /** * @stability stable */ export declare enum DataDogLoggingMode { /** * Forward logs directly to Datadog using AWS FireLens as log router, see https://docs.datadoghq.com/integrations/ecs_fargate/?tab=fluentbitandfirelens#log-collection. * * @stability stable */ AWS_FIRE_LENS = 0, /** * Store logs in AWS Cloudwatch and use the Datadog log forwarder lambda to forward the logs to Datadog, see https://docs.datadoghq.com/integrations/ecs_fargate/?tab=logdriver#log-collection. * * @stability stable */ FORWARDER_LAMBDA = 1, /** * Only log to AWS Cloudwatch without forwarding the logs to Datadog. * * @stability stable */ NONE = 2 } /** * @stability stable */ export declare class RioFargateService extends cdk.Construct implements ec2.IConnectable { private readonly DEFAULT_APM_GET_ENDPOINTS_TO_IGNORE; private readonly DEFAULT_DATADOG_SIDECAR_CPU; private readonly DEFAULT_DATADOG_SIDECAR_MEMORY_LIMIT_MIB; private readonly DEFAULT_DATADOG_SIDECAR_ESSENTIAL; private readonly DEFAULT_LOGGING_MODE_FOR_SERVICE; private readonly DEFAULT_LOGGING_MODE_FOR_DATADOG_SIDECAR; private readonly DEFAULT_DEREGISTRATION_DELAY; private readonly DEFAULT_SLOW_START; private readonly DEFAULT_DATADOG_SIDECAR_TAG; private readonly LOG_ROUTER_CPU; private readonly LOG_ROUTER_MEMORY_LIMIT_MIB; /** * @stability stable */ readonly serviceContainerDefinition: ecs.ContainerDefinition; /** * @stability stable */ readonly datadogSideCarContainerDefinition: ecs.ContainerDefinition; /** * @stability stable */ readonly logRouterContainerDefinition?: ecs.ContainerDefinition; /** * @stability stable */ readonly taskDefinition: ecs.FargateTaskDefinition; /** * The network connections associated with this resource. * * @stability stable */ readonly connections: ec2.Connections; /** * @stability stable */ readonly service: ecs.FargateService; /** * @stability stable */ readonly targetGroup: elbv2.ApplicationTargetGroup | undefined; /** * @stability stable */ constructor(scope: cdk.Construct, id: string, props: RioFargateServiceProps); }