Ok so cactus likes sun, little water, and sandy soil. Little water means that they like to get watered and then left alone until it is completely dry. I would plant it in cactus mix, it is very sandy full of small pebbles. Also you could plant it in clay pot, it is nicer and helps roots not to cook.
How do you know it is dying? I cannot tell from the picture.
It looks like some kind of cereus, but I cannot be sure. The pot looks very big for it and the media has a lot of organic matter. I would put the catus in the smallest pot that the root will fit in and use cactus mix which dries out faster. I use cement and terra cotta pots because these can be very top heavy and plastic pots fall over and do not breathe.
Happy gardening in Hawaii. Gardens are where people grow.