V = IR. So R = V/I.
When the supply voltage is considerably higher than the forward voltage of the LED, the calculation can be approximated by taking V as the supply voltage subtracted by the LED forward voltage. Therefore:
(3.3-2)/0.02 = 65ohm, or higher.
(5-2)/0.02 = 150ohm, or higher.
Beware: even if it's rated at 3.3V, or 5V, the voltage can be a bit higher or lower than that because of the tolerance. Same goes for the resistor, there's a tolerance. Let's assume that the tolerance is 5% for the power supply:
(3.3*1.05-2)/0.02 = 73ohm.
(5*1.05-2)/0.02 = 162ohm.
Now let's handle the resistance tolerance. 73/0.95 would be 76.8ohm. 162/0.95 would be 170.5ohm. So picking a resistor with higher than these values would be safe.
Just ensure that current is less than 20mA and the LED is good. When in doubt, get a multimeter and measure it.