Create AMI in Amazon EC2 using packer

{
“variables”: {
“aws_access_key”: “”,
“aws_secret_key”: “”

},
"builders": [
{
  "type": "amazon-ebs",
  "access_key": "{{user `aws_access_key`}}",
  "secret_key": "{{user `aws_secret_key`}}",
  "region": "us-east-1",
  "source_ami": "ami-04a81a99f5ec58529",
  "instance_type": "t2.micro",
  "ssh_username": "ubuntu-ec2-user",
  "ami_name": "packer-jenkins-ami{{time-stamp}}"
}

],
“provisioners”: [
{
“type”: “shell”,
“inline”: [
“sudo yum update -y”,
“sudo yum remove java -y”,
“sudo yum install java-1.8.0-openjdk-devel -y”,
“sudo wget -O /etc/yum.repos.d/jenkins-ci.org/redhat/jenkins.repo”,
“sudo yum install jenkins -y”
]
}
]
}

Hi guys, any help will be appreciated.

See the above script for .json file. I am working through an example in a book. I cannot run any command in vs code terminal. Every time I run any command , packer build -var… firstawsami-packer.json , it says "no such file or directory,

What I am doing wrong? Which terminal do I run my command? I have packer installed and also installed a packer extension in vs code

I am new to this and unfortunately using a book to guide me and I am stubbornly insisting on using examples in the book. I have seen others use .hcl files but I am keen to get this specific .json file working.

I have already provisioned a VPC with security groups, subnets etc and it is up and running. So this AMI is supposed to be a continuation to that project.

How did you install packer?
If you run packer --version, do you get any output?