Map from Google - Cocos_Islands

The climate of the Cocos (or Keeling) Islands, a territory of Australia in the Indian Ocean, is tropical, with a warmer period from December to May, during which the maximum temperature hovers around 29/30 °C (84/86 °F), and a relatively cool period from June to November, during which the maximum temperature drops to around 27/28 °C (81/82 °F). The warmest months, albeit slightly, are February and March, when the maximum temperature reaches more often 30 °C (86 °F). The temperature is very stable, and it practically never gets either cold or very hot.
Here are the average temperatures of West Island.
Average temperatures - West Island
West IslandJanFebMarAprMayJunJulAugSepOctNovDec
West IslandJFMAMJJASOND
Min (°C)242525252524232323232424
Max (°C)293030292828272728282829
Min (°F)757777777775737373737575
Max (°F)848686848282818182828284

The relative humidity is always high, but the heat is tempered by the trade winds which blow throughout the year, with a greater intensity in the coolest months (July and August), and a lower intensity in the warmest months (February and March).
Rainfall is abundant, around 2,000 millimetres (79 inches) per year; there is not a dry period, even though the rains, which occur in the form of downpour or thunderstorm, are more abundant from January to July, when they swing around 200 millimetres (8 inches) per month, with a maximum in March and April. The least rainy period goes from September to November, when the rainfall amount is lower than 100 mm (4 in) per month. The rainfall records, however, are high even in the months that are generally less rainy, which means that in some years the rains do not follow the same pattern. Here is the average precipitation.
Average precipitation - West Island
West IslandJanFebMarAprMayJunJulAugSepOctNovDecYear
West IslandJFMAMJJASONDY
Prec. (mm)1901602302301902002101308070901101890
Prec.(in)7.56.39.19.17.57.98.35.13.12.83.54.374.4
Days111215141416161310888145

There's no shortage of sunshine even in the wettest months, because the tropical rains occur mainly in the form of downpour or thundestorm, so they do not last long, however, the sun shines for more hours in the driest season.
The Cocos Islands can be affected by the tropical cyclones of the southern Indian Ocean, whose season runs from November 1 to May 15, although they are more frequent from November to March.

Cocos Islands

For swimming, the sea is warm all year round, as you can see in the following table.
Sea temperature - Cocos Islands
Cocos IslandsJanFebMarAprMayJunJulAugSepOctNovDec
Cocos IslandsJFMAMJJASOND
Sea (°C)282828282828272727272727
Sea (°F)828282828282818181818181

When to go

The best time to visit the Cocos Islands corresponds to the months of September and October, being on average the least rainy; however, some showers should be taken into account also in this period. Even August is typically an acceptable month, although it's a bit more rainy.

What to pack

All year round, light clothes, a scarf for the breeze, a light sweatshirt for the evening, light raincoat or umbrella, especially in the rainy season.