AWS
Connect an AWS account so Fluid can run jobs on EC2 instances, spot or on-demand, CPU or GPU.
Warnings and limits
- Spot instances get a 2-minute notice. Fluid checkpoints and suspends the job inside it, then waits for you to resume it. On-demand instances get no notice.
- Launches count against your account's regional EC2 vCPU quotas, which are separate for spot and on-demand and for each instance family (standard, G and VT, P). Fluid reads them; it never requests an increase.
- When EC2 has no capacity or the quota has no room, Fluid keeps trying for up to 5 minutes, then moves to the next offer (4 in all) before the job ends as no capacity.
- AWS Fargate offers run from Fluid's public daemon image. Fargate Spot gives a 2-minute notice.
- An AWS Fargate task has no GPU and no machine type. A spec for one names
cpu=andmemory_gb=(--on fargate:cpu=4:memory_gb=8), and the task's disk follows its memory, from 20 to 200 GB. A spec that names a GPU, a machine type ordisk_gb=there is refused with what to name instead. - After a GPU job's program ends, EC2 takes minutes to terminate the instance (about 6.5 minutes for a g4dn.xlarge). The console reads the run as Finishing with what it waits for,
fluid pssaysrunninguntil EC2 confirms, nothing after the program's exit is charged, and a stop sent in that window changes nothing. - Quotes leave out EBS volumes, public IPv4 addresses and data transfer, which AWS bills too.
Connect
The recommended way makes an IAM role in your account that Fluid assumes. Nothing that could be replayed is stored:
fluid connect aws --from-cliUse --profile P for another AWS CLI profile and --region R for the connection's region (us-east-1 by default). The command:
- asks Fluid for an ExternalId bound to your workspace (it is valid 24 hours until used);
- prints every step, and asks before it makes anything;
- creates the role, with a trust policy for Fluid's identity and that ExternalId, and attaches Fluid's policy;
- tags the region's default VPC so Fluid's security groups can be made there, and saves the connection, which Fluid then verifies.
To use an IAM user and access key instead, add --keys: the key is sealed on Fluid's side and never shown again. You can also enter a role ARN or an access key on the console's Connect page.
What the role allows
The policy allows exactly the calls Fluid makes, and only on resources Fluid tags:
- start EC2 instances only when they carry the tag
soma:managed=true, from public images, in Fluid's own tagged security groups, and with no snapshot attached; - terminate, and read the console output of, tagged instances only;
- read instance types, prices, spot price history, subnets and VPCs, and the EC2 vCPU quotas;
- run AWS Fargate tasks in an ECS cluster named
portal, and write logs only under/soma/; - send spot interruptions through AWS FIS, for
fluid interrupttests; - read Cost Explorer, to reconcile Fluid's cost estimates with your bill once a day.
It cannot touch instances, volumes or snapshots Fluid did not create.
Private networking for multi-node jobs
An EC2 GPU group uses one AWS connection, one region and its default VPC. Its EC2 instances are on-demand and use the same instance type. Fluid creates a security group for each generation of the job. Ranks communicate over private network interfaces, with inbound traffic allowed from other members of that security group. The destination of a move gets its own group and can be in another region.
To enable multi-node jobs, attach this additional IAM policy to the role or IAM user used by your Fluid connection. Replace 123456789012 with your AWS account number and use your partition in the ARN.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": "ec2:DeleteSecurityGroup",
"Resource": "arn:aws:ec2:*:123456789012:security-group/*",
"Condition": {
"StringEquals": {
"aws:ResourceTag/soma:managed": "true",
"aws:ResourceTag/soma:role": "rank-peer"
}
}
}]
}After verifying the grant, record it on the existing connection. Run fluid connect aws --method role (use keys for an IAM user) while signed in with permission to edit connections. Leave the credential fields blank to keep their saved values and enter 1 for Managed rank-peer cleanup policy installed. For a named connection, use its full name such as aws.research.
The equivalent authenticated API call is POST /api/connections/aws with the JSON body {"method":"role","values":{"rank_peer_policy":"1"}}. Use the connection's actual method and name. Fluid checks delete permission against the generation's security group before starting its instances.
Instances
| Family | GPU | Sizes with one GPU | Sizes with several GPUs |
|---|---|---|---|
| c7i, m7i, r7i | none | large to 8xlarge | |
| g4dn | NVIDIA T4 | xlarge to 4xlarge | 12xlarge (4) |
| g5 | NVIDIA A10G | xlarge to 4xlarge | 12xlarge (4), 24xlarge (4), 48xlarge (8) |
| g6 | NVIDIA L4 | xlarge to 4xlarge | 12xlarge (4), 24xlarge (4), 48xlarge (8) |
| g6e | NVIDIA L40S | xlarge to 4xlarge | 12xlarge (4), 24xlarge (4), 48xlarge (8) |
| p4d | NVIDIA A100 40 GB | 24xlarge (8) | |
| p5 | NVIDIA H100 | 4xlarge | 48xlarge (8) |
fluid prices shows the offers your connection can take, with spot and on-demand prices. An exact spec for EC2 names an instance type (--on aws:g4dn.xlarge:spot): one that names only a GPU (aws:gpu=T4) is refused, and its offer shows the type's own vCPUs and memory.
A job that asks for one GPU is quoted only machines with one. A job that asks for several (--gpus N, --ranks N) is quoted the machines with at least that many:
- These families have no size with two GPUs. A job that asks for two is quoted a machine with four, at that machine's price, and the plan says so.
- The vCPU quota counts the whole machine: 48 vCPUs for a size with four GPUs, 96 for a 24xlarge and for p4d, 192 for a size with eight. A quota sized for one GPU runs none of them. An offer your quota cannot fit names the quota and the number to ask AWS for.
- A machine with several GPUs gets a larger root disk: 100 GB plus 1.1 GB for each GB of all its GPUs' memory, for example 171 GB with four T4s and 206 GB with four A10Gs.
disk_gb=in a spec sets your own. The disk is billed by AWS and is not in the quoted price. - A machine that does not show every GPU its type has is ended before your job starts, and Fluid tries the next offer.
Spot notices
EC2 posts a spot interruption to the instance 2 minutes before it reclaims it. Fluid's daemon on the instance sees it, and Fluid pauses the program at its next safe point, saves a checkpoint and suspends the job. The pool that reclaimed the machine is left out of new placements for 30 minutes. See Spot interruptions and checkpoints.
Quotas and capacity
A quote lists an instance type only in the regions where EC2 offers it, and --on with a type its region does not offer is refused with "EC2 does not offer TYPE in REGION". --on with a GPU type outside the table above starts it as a GPU machine when its family is one AWS's GPU image supports (G4dn, G5, G6, Gr6, Gr6f, G6e, G6f, G7, G7e, P4d, P4de, P5, P5e, P5en, P6-B200, P6-B300), with the GPUs EC2 lists for it. A GPU type of any other family, such as p3dn.24xlarge, is refused: that image does not drive its GPUs. A GPU spot quote carries EC2's Spot placement score. EC2 limits how many new score requests an account makes in a day, so Fluid asks for at most 36 new ones a day in a region, the quotes' own first; a quote or a launch past that shows no capacity estimate. When a score cannot be read again, the last one serves for up to an hour and says how old it is.
Before each launch Fluid reads the regional vCPU quota the instance counts against and skips instance types the quota has no room for. Instances still shutting down count too. When the quota is smaller than one instance of a type, that type is refused for good; request an increase in the Service Quotas console. See Quotas and capacity.