Using vault aws secrets engine with nomad templates

I want to use the aws secrets engine to create the iam access_key and secret_key, and then pass it as env variables into the nomad job. How do I accomplish this?

      template {
        data = <<EOH
{{ with write "aws/sts/service-name" "ttl=60m"}}
	AWS_ACCESS_KEY_ID="{{ .Data.access_key }}"
	AWS_SECRET_ACCESS_KEY="{{ .Data.secret_key }}"
{{ end }}
EOH

		destination = "secrets/file.env"
  		env         = true
      }

I am trying to mimick this command that you need to run to create the sts tokens

vault write aws/sts/service-name ttl=60m

But that doesnt seem to work.