import re

pattern = r"\bCarnival: monitor service-([a-z]{2}) Beta\b"
r = "Carnival: monitor service-eu Beta cloudwatch_module"
m = re.search(pattern, r)
if m:
    test_string1 = m.group(1)
    test_string = test_string1.upper()

    print(test_string)
    print(test_string1)