In this blog, I will show you how to write a Python script that will list all the support cases raised from your AWS account. This script can be very useful when you want a report showing the information about AWS support cases are either open or in resolved state.
Let's begin with importing Boto3 and Tabulate module. Tabulate module will help us to present the output in table format. You can install Tabulate module by running pip install tabulate command.
Once you've imported the require modules, we can set up the connection to AWS by giving the default profile and region name. At this stage, we can only use "us-east-1" region to run any commands to fetch support case details. So, we will be using the same region in our code too.
Now, here is the actual code where we will gather the information about all the cases, covert in to list variable and then pull the required output.
Once we have gathered the required information, we will use Tabulate function with Print command to format the output.
tabulate supports different formats like html, Grid, plain and Github etc... Please visit https://pypi.org/project/tabulate/ for more information on Tabulate.
Hope you find it useful.
Disclaimer: www.TechieTalks.co.uk does not conceal the possibility of error and shortcomings due to human or technical factors. www.TechieTalks.co.uk does not bear responsibility upon any loss or damage arising from conduct or activities related to the use of data and information contained in this blog.
Comments
Post a Comment