parse_ec2_info module

parse_ec2_info.get_ec2_details(list_df, ec2_client)

Returns the complete detail lists

Parameters:
  • list_df (pd dataframe) – Instance List

  • ec2_client (boto_client) – Boto EC2 client

Returns:

instance_data, security_rules_data, volume_data, instance_tags_data

Return type:

list, list, list, list

parse_ec2_info.get_instance_info(instance_id, ec2_client)

Returns all info related to an EC2 instance

Parameters:
  • instance_id (string) – Instance ID

  • ec2_client (boto_client) – EC2 Boto client

Returns:

instance_info, security_rules, volumes, instance_tags

Return type:

list, list, list, list

parse_ec2_info.get_subnet_name(subnet_id, ec2_client)

Returns Subnet Name

Parameters:
  • subnet_id (string) – Subnet ID

  • ec2_client (boto_client) – EC2 Boto client

Returns:

Subnet Name

Return type:

string

parse_ec2_info.get_vpc_name(vpc_id, ec2_client)

Returns VPC Name

Parameters:
  • vpc_id (string) – VPC ID

  • ec2_client (boto_client) – EC2 Boto client

Returns:

VPC Name

Return type:

string

parse_ec2_info.init_aws_clients(region)

Initializes EC2 boto client

Parameters:

region (string) – AWS Region

Returns:

EC2 client

Return type:

boto_client

parse_ec2_info.logActions(level, short_desc, long_desc)

Formats and prints logs

Parameters:
  • level (string) – Log level (INF,ERR)

  • short_desc (string) – Short log message

  • long_desc (string) – Long log message

parse_ec2_info.read_excel(file_path)

Reads the source server list from the XLS doc and returns a list

Parameters:

file_path (string) – path to the XLS doc

Returns:

Source server list

Return type:

list

parse_ec2_info.update_workbook(instance_data, security_rules_data, volume_data, instance_tags_data, file_path)

Updates the XLS doc with EC2 related info

Parameters:
  • instance_data (list) – Instance data

  • security_rules_data (list) – Security Group data

  • volume_data (list) – Volume data

  • instance_tags_data (list) – Instance tags data

  • file_path (string) – Path to the XLS doc