How to add swap to ECS containers?

My EC2 instance is running out of memory, and I thought adding swap could help

I’m not sure EC2 ran out of memory or container did, following is screenshot of EC2 offered by AWS get-instance-screenshot

ScreenShot of instance

Doc at says we can add swap.. So I added the following to task definition and deployed it

        "linuxParameters": {
            "capabilities": null,
            "sharedMemorySize": null,
            "tmpfs": null,
            "devices": null,
            "maxSwap": 2048,
            "swappiness": 60,
            "initProcessEnabled": null

I log in to the ec2 host and see top, there’s no Swap assigned (0 total, 0 free) both in host and container..

What am I missing?

Source: StackOverflow