ion
ion copied to clipboard
`Service` lacks flexibility
I am migrating from SST 2 and I noticed that Service seems much more flexible there.
Use case: Deploy a container with minimum costs - no ALB, no scaling, using Fargate Spot when possible. This is good for chatbots and other apps that do not need to be reachable directly by the public and can possibly sustain little downtime sometimes. Depending on the setup, an ALB can easily be more expensive than the actual service!
In SST 2:
const service = new Service(ctx.stack, id, {
scaling: {
maxContainers: 1, // some bots are not allowed to have more than 1 connection (e.g. whatsapp-web.js)
},
cdk: {
applicationLoadBalancer: false,
cloudfrontDistribution: false,
fargateService: {
enableExecuteCommand: true,
assignPublicIp: true,
maxHealthyPercent: 100, // some bots are not allowed to have more than 1 connection (e.g. whatsapp-web.js)
minHealthyPercent: 0,
desiredCount: 1,
capacityProviderStrategies: [
{
capacityProvider: 'FARGATE_SPOT',
weight: 100,
base: 1,
},
{
capacityProvider: 'FARGATE',
weight: 1,
},
],
...
So far, in ION, I got this (incomplete):
const service = cluster.addService(id, {
transform: {
loadBalancer: ???, // LB seems to be adjustable, but not disabled
service: {
capacityProviderStrategies: [
{
capacityProvider: 'FARGATE_SPOT',
weight: 100,
base: 1,
},
{
capacityProvider: 'FARGATE',
weight: 1,
},
],
},
},
...
Any suggestions of workarounds? If none is possible, should I work on a PR for it?