ec2#

boto3 EC2 API utilities.

packer_ami_workflow.ec2.extract_essential_attributes_from_image_list(images: List[Image]) List[Dict[str, Any]][source]#

The original simple_aws_ec2.Image object has too many attributes, this function can extract important attributes only for print.

packer_ami_workflow.ec2.find_root_base_ami(ec2_client: EC2Client, source_ami_name: str, source_ami_owner_account_id: str) List[Image][source]#

This is the alternative of source_ami_filter feature in packer.

It finds the root base ami by name and owner account id.

packer_ami_workflow.ec2.find_ami_by_name(ec2_client: EC2Client, ami_name: str) Image[source]#

Find AMI object by its name. Since the ID is a generated value that we don’t know, we usually locate AMI by name. In AMI project, we usually own these AMIs.

Parameters:
packer_ami_workflow.ec2.tag_image(ec2_client: EC2Client, image_name: str, tags: Optional[Dict[str, str]] = None) str[source]#

Tag the image with the given name.

Parameters:
  • bsm – BotoSesManager

  • image_name – The unique name of the image that can be used to locate the ami id

  • tags – The tags to apply to the image.