awesome thanks! On Saturday, September 22, 2018 at 2:21:55 AM UTC-4, Rickard von Essen wrote: > > I would THINK the post-processor would execute before the instance is >> terminated. >> > No, the post+processor run on the artifact of the builder, which in this > case is the AMI. > > Instead I suggest that you as your last provisioner runs a shell > provisioner which runs the AWS cli on the instance. > It can use the metadata service 1) to get the instance id and > iam_instance_profile 2) to allow it to export it self. > > To no finishing up by snapshoting the EBS and creating the AMI (which you > don't want) you can exit the script with a non zero value. To differentiate > this from another failure you can just before that use file provisioner > with download to pass a marker file to the packer host to mark success. > > 1) > https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html > curl http://169.254.169.254/latest/meta-data/instance-id > > 2) https://packer.io/docs/builders/amazon-ebs.html#iam_instance_profile > > On Fri, 21 Sep 2018 at 18:34, Kevin Milner <[email protected] > <javascript:>> wrote: > >> I'm trying to export an ovf from an EC2 instance on AWS and I have a >> question about the post-processor. >> I would THINK the post-processor would execute before the instance is >> terminated. My plan was to call a script to use aws cli to export the >> instance as an ovf (which then saves the ovf to a bucket in s3. >> The problem seems to be that the aws command is to create the ovf from an >> INSTANCE (see >> https://docs.aws.amazon.com/cli/latest/reference/ec2/create-instance-export-task.html) >> >> but by the time the post-processor gets to it, packer has already >> terminated the instance on AWS and all I'm left with is an AMI. I would >> like to avoid spinning the AMI back up into an instance, then exporting the >> instance if I can avoid it. >> Is there some way I can tell packer to keep the instance up (or at least >> not terminated and deleted) until I can export the OVF? >> Another question I have is about the builder itself. Is there some way I >> can get the instance ID from the builder? It displaces the instance id when >> first building, and that would be useful since I need it for the export >> command. All I know how to get is the ami id (aws ec2 describe-images >> --<stuff>). >> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/packer-tool/077d6b3b-901a-4f3a-86d8-e496a8732b2c%40googlegroups.com >> >> <https://groups.google.com/d/msgid/packer-tool/077d6b3b-901a-4f3a-86d8-e496a8732b2c%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> >
-- 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/c9ab8e70-cfe7-4e2a-a0e0-c092a3b2b61d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
