How do I train my puppy german shepherd to follow me?

I wanna know how i can train my german shepherd pup to follow me so when its older i can take it to the beach without it running away.
If I spend everyday all day with it looking after it Loving it all that stuff will it just follow anyway or does it need training?