Class FargateService
This creates a service using the Fargate launch type on an ECS cluster.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public class FargateService : BaseService, IBaseService, IApplicationLoadBalancerTarget, INetworkLoadBalancerTarget, ILoadBalancerTarget, IConnectable, IFargateService, IService, IResource, IConstruct, IDependable
Syntax (vb)
Public Class FargateService
Inherits BaseService
Implements IBaseService, IApplicationLoadBalancerTarget, INetworkLoadBalancerTarget, ILoadBalancerTarget, IConnectable, IFargateService, IService, IResource, IConstruct, IDependable
Remarks
Resource: AWS::ECS::Service
ExampleMetadata: infused
Examples
Cluster cluster;
TaskDefinition taskDefinition;
Vpc vpc;
var service = new FargateService(this, "Service", new FargateServiceProps { Cluster = cluster, TaskDefinition = taskDefinition });
var lb = new ApplicationLoadBalancer(this, "LB", new ApplicationLoadBalancerProps { Vpc = vpc, InternetFacing = true });
var listener = lb.AddListener("Listener", new BaseApplicationListenerProps { Port = 80 });
service.RegisterLoadBalancerTargets(new EcsTarget {
ContainerName = "web",
ContainerPort = 80,
NewTargetGroupId = "ECS",
Listener = ListenerConfig.ApplicationListener(listener, new AddApplicationTargetsProps {
Protocol = ApplicationProtocol.HTTPS
})
});
Synopsis
Constructors
FargateService(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
FargateService(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
FargateService(Construct, String, IFargateServiceProps) | Constructs a new instance of the FargateService class. |
Methods
FromFargateServiceArn(Construct, String, String) | Imports from the specified service ARN. |
FromFargateServiceAttributes(Construct, String, IFargateServiceAttributes) | Imports from the specified service attributes. |
Constructors
FargateService(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected FargateService(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
FargateService(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected FargateService(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
FargateService(Construct, String, IFargateServiceProps)
Constructs a new instance of the FargateService class.
public FargateService(Construct scope, string id, IFargateServiceProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IFargateServiceProps
Methods
FromFargateServiceArn(Construct, String, String)
Imports from the specified service ARN.
public static IFargateService FromFargateServiceArn(Construct scope, string id, string fargateServiceArn)
Parameters
- scope Constructs.Construct
- id System.String
- fargateServiceArn System.String
Returns
FromFargateServiceAttributes(Construct, String, IFargateServiceAttributes)
Imports from the specified service attributes.
public static IBaseService FromFargateServiceAttributes(Construct scope, string id, IFargateServiceAttributes attrs)
Parameters
- scope Constructs.Construct
- id System.String
- attrs IFargateServiceAttributes
Returns