Getting started with AWS Fargate
There is a public container image available to quickly get started. The only requirement here is a valid license.
A trial license can be obtained by registering over here.
CloudFormation through CLI
CloudFormation Template
AWSTemplateFormatVersion: '2010-09-09'
Resources:
TaskDefinition:
Type: AWS::ECS::TaskDefinition
Properties:
Cpu: 256
Memory: 512
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
ContainerDefinitions:
- Name: Callable-Task
Image: gcr.io/openapi4sap/callable
Environment:
- Name: license
Value: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
- Name: jco__client__ashost
Value: 0.0.0.0
- Name: jco__client__client
Value: 000
- Name: jco__client__user
Value: user1
- Name: jco__client__passwd
Value: secret1
- Name: jco__client__sysnr
Value: 00
PortMappings:
- ContainerPort: 8080
Service:
Type: AWS::ECS::Service
Properties:
ServiceName: Callable-Service
LaunchType: FARGATE
DesiredCount: 1
NetworkConfiguration:
AwsvpcConfiguration:
AssignPublicIp: ENABLED
SecurityGroups:
- !Ref SecurityGroup
Subnets:
- subnet-3799367f
- subnet-379c4551
- subnet-acfee6f7
TaskDefinition: !Ref 'TaskDefinition'
SecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Security Group for Callable ECS instance
SecurityGroupIngress:
- CidrIp: "0.0.0.0/0"
FromPort: 8080
ToPort: 8080
IpProtocol: Tcp
- CidrIpv6: "::/0"
FromPort: 8080
ToPort: 8080
IpProtocol: Tcp
VpcId: vpc-59f0673f
You can instantiate the template with the following command:
aws cloudformation create-stack --stack-name callable-fargate --template-body file://callable-fargate.yml
After the stack is fully initialized, you can retrieve the public IP through the following command sequence.
aws ecs list-tasks
{
"taskArns": [
"arn:aws:ecs:eu-west-1:714738665598:task/default/bf9858bc0b2c4e65835e50cc1578b29c"
]
}
aws ecs describe-tasks --tasks arn:aws:ecs:eu-west-1:714738665598:task/default/bf9858bc0b2c4e65835e50cc1578b29c
{
"tasks": [
{
"attachments": [
{
"id": "b646ce75-c98f-4ef0-99ef-5a31335958a9",
"type": "ElasticNetworkInterface",
"status": "ATTACHED",
"details": [
{
"name": "subnetId",
"value": "subnet-379c4551"
},
{
"name": "networkInterfaceId",
"value": "eni-0d3eb1d77167cecfd"
},
{
"name": "macAddress",
"value": "02:95:38:c0:fc:70"
},
{
"name": "privateIPv4Address",
"value": "172.31.2.185"
}
]
}
],
aws ec2 describe-network-interfaces --network-interface-ids eni-0d3eb1d77167cecfd
{
"NetworkInterfaces": [
{
"Association": {
"IpOwnerId": "amazon",
"PublicDnsName": "ec2-54-154-134-165.eu-west-1.compute.amazonaws.com",
"PublicIp": "54.154.134.165"
},
"Attachment": {
"AttachTime": "2020-01-05T19:25:24.000Z",
"AttachmentId": "eni-attach-01542d008101dc71c",
"DeleteOnTermination": false,
"DeviceIndex": 1,
"InstanceOwnerId": "452886133366",
"Status": "attached"
},
"AvailabilityZone": "eu-west-1c",
"Description": "arn:aws:ecs:eu-west-1:714738665598:attachment/b646ce75-c98f-4ef0-99ef-5a31335958a9",
"Groups": [
{
"GroupName": "callable-fargate-SecurityGroup-1TW9ZYCODYKQD",
"GroupId": "sg-020eb403806e4ba77"
}
],
"InterfaceType": "interface",
"Ipv6Addresses": [],
"MacAddress": "02:95:38:c0:fc:70",
"NetworkInterfaceId": "eni-0d3eb1d77167cecfd",
"OwnerId": "714738665598",
"PrivateDnsName": "ip-172-31-2-185.eu-west-1.compute.internal",
"PrivateIpAddress": "172.31.2.185",
"PrivateIpAddresses": [
{
"Association": {
"IpOwnerId": "amazon",
"PublicDnsName": "ec2-54-154-134-165.eu-west-1.compute.amazonaws.com",
"PublicIp": "54.154.134.165"
},
"Primary": true,
"PrivateDnsName": "ip-172-31-2-185.eu-west-1.compute.internal",
"PrivateIpAddress": "172.31.2.185"
}
],
"RequesterId": "578734482556",
"RequesterManaged": true,
"SourceDestCheck": true,
"Status": "in-use",
"SubnetId": "subnet-379c4551",
"TagSet": [],
"VpcId": "vpc-59f0673f"
}
]
}
Afterwards open a browser and go to the presented location, here it is http://ec2-54-154-134-165.eu-west-1.compute.amazonaws.com:8080
.
For more details about the available enironment variables, please check on our Configuration page