Some of these pictures and descriptions may give away plot details that you might not want to know before watching the film.
This is one of the few big budget Michael Bay action movies that wasn't a huge hit at the box office. It's sort of an update of Logan's Run, the 1976 Sci-Fi classic.
Jordan Two Delta (Scarlett Johansson) and Lincoln Six Echo (Ewan McGregor) have just escaped from a giant corporate cloning complex hidden deep underground in an old military bunker in the Arizona desert some time in the near future. They were raised in what they were taught to believe is an underground utopia populated by survivors of a mass contamination event that killed almost all life on earth. After they escape, they find out that they were lied to.
The first living creature they see after they get outside is a rattlesnake. They don't know what it is, but the fact that it's alive is proof to them there is still life outside the complex. Like all movie rattlesnakes, this one rattles constantly and strikes. That's not always true of rattlesnakes. Lincoln Six Echo repeats the myth that rattlesnakes are just plain mean and not just animals defending themselves. But at least he and Jordan Two Delta leave the snake alone and keep running instead of killing the snake or getting bitten by it, as people do in most movies.
I'm going to guess that the movie uses a rattlesnake because the two are supposed to learn that there are other dangerous animals outside the complex besides the mercenaries in black helicopters who are hunting them. Or maybe they just used a rattlesnake to excite us because that's what big macho action movies are about. Nevertheless, I consider this one of the rare appearances of a rattlesnake or any other kind of snake in a movie that is shown in a fairly realistic way, because it isn't used here only to provide a convenient dramatic plot-change device like a snakebite or a heroic snake killing.
The snake used in the scene is a location-appropriate Western Diamond-backed Rattlesnake. I don't know how they filmed the shot. Visual effects are so good now that they can make me believe anything. It's probably a composite shot, where they combined a shot of the actors with a separate shot of the snake. But it's also possible the actors are actually in the shot with a live snake, probably with a pane of glass between them and the snake. It even looks like the snake hits the glass when it strikes.