you want to feed there the AMI name of the current running instance? Your script should be able to get this from the metadata
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html *curl http://169.254.169.254/latest <http://169.254.169.254/latest>/meta-data/ami-id* ami-12345678 Alvaro. On Wed, Nov 29, 2017 at 9:14 AM, sibi das <[email protected]> wrote: > Hi, > > I am running a script in provisioners section, which requires AMI name > used by packer. I know the pre-validation of AMI name by packer happens > before this stage. Is there any reliable way in which I can get the > ami_name inside my script ? > > My script would go like this: > > "provisioners": [ { "type": "shell", "execute_command": "sudo {{.Vars}} > bash '{{.Path}}'", "scripts": [ "./scripts/packer/myscript.sh" ] } ] > > ./scripts/packer/myscript.sh: > > #!/usr/bin/env bash aminame=$ami_name make_an_external_call "$aminame" > > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/packer-tool/a88ca74e-0415-4b96-ad5a-340af42f0d36%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/a88ca74e-0415-4b96-ad5a-340af42f0d36%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Alvaro -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CAHqq0exknP3N8FWQw8Ojj7xexWDZHrYekj1DOsV5AM9kaNGqtA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
