Interface IFargateServiceProps
The properties for defining a service using the Fargate launch type.
Inherited Members
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IFargateServiceProps : IBaseServiceOptions
Syntax (vb)
Public Interface IFargateServiceProps
Inherits IBaseServiceOptions
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.CloudWatch;
Cluster cluster;
TaskDefinition taskDefinition;
Alarm elbAlarm;
var service = new FargateService(this, "Service", new FargateServiceProps {
Cluster = cluster,
TaskDefinition = taskDefinition,
DeploymentAlarms = new DeploymentAlarmConfig {
AlarmNames = new [] { elbAlarm.AlarmName },
Behavior = AlarmBehavior.ROLLBACK_ON_ALARM
}
});
// Defining a deployment alarm after the service has been created
var cpuAlarmName = "MyCpuMetricAlarm";
new Alarm(this, "CPUAlarm", new AlarmProps {
AlarmName = cpuAlarmName,
Metric = service.MetricCpuUtilization(),
EvaluationPeriods = 2,
Threshold = 80
});
service.EnableDeploymentAlarms(new [] { cpuAlarmName }, new DeploymentAlarmOptions {
Behavior = AlarmBehavior.FAIL_ON_ALARM
});
Synopsis
Properties
AssignPublicIp | Specifies whether the task's elastic network interface receives a public IP address. |
PlatformVersion | The platform version on which to run your service. |
SecurityGroups | The security groups to associate with the service. |
TaskDefinition | The task definition to use for tasks in the service. |
VpcSubnets | The subnets to associate with the service. |
Properties
AssignPublicIp
Specifies whether the task's elastic network interface receives a public IP address.
virtual Nullable<bool> AssignPublicIp { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
If true, each task will receive a public IP address.
Default: false
PlatformVersion
The platform version on which to run your service.
virtual Nullable<FargatePlatformVersion> PlatformVersion { get; }
Property Value
System.Nullable<FargatePlatformVersion>
Remarks
If one is not specified, the LATEST platform version is used by default. For more information, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide.
Default: Latest
SecurityGroups
The security groups to associate with the service.
virtual ISecurityGroup[] SecurityGroups { get; }
Property Value
Remarks
If you do not specify a security group, a new security group is created.
Default: - A new security group is created.
TaskDefinition
The task definition to use for tasks in the service.
TaskDefinition TaskDefinition { get; }
Property Value
Remarks
[disable-awslint:ref-via-interface]
VpcSubnets
The subnets to associate with the service.
virtual ISubnetSelection VpcSubnets { get; }
Property Value
Remarks
Default: - Public subnets if assignPublicIp
is set, otherwise the first available one of Private, Isolated, Public, in that order.