Could you please tell me if it is possible to use "as" in this context, or only "like" can be used, or both options are possible?
This is a tricky question, because the difference between simile and metaphor becomes muddled in poetic writing. Sentences 1 and 2 have different meanings:
1. The water sparkled like diamonds in the sunset
2. The water sparkled as diamonds in the sunset
Sentence 1 means that the water was similar to diamonds (in its sparkling). Sentence two means that the water literally is diamonds. Of course, sentence two is factually incorrect - water is not diamonds. However, because the metaphor (sparkling as diamonds) is a more powerful statement, authors are well known to use this language figuratively to try and convey more forcefully the resemblance of the two things.
So, either is valid and idiomatic English - though one is factually incorrect prose used for effect. I'd recommend you use 1, though, because it's best to make a habit of factually accurate statements, and it can be hard to tell when the figurative language is idiomatic and when it is not.