When retrieving the AMI Creation Date from boto3 it returns a
string data type. Visually, this is okay but it is challenging to do operations and comparisons to the AMI Creation Date in this format.
To solve the issue we need to convert the AMI Creation Date from type
datetime before we could do some operations.
The AMI Creation Date string looks like
Continue reading boto3: Convert AMI Creation Date from string to Python datetime
2019-09-18T07:34:34.000Z. To convert this we need to use the
strptime function from the
My favorite Python connector for MySQL or MariaDB is MySQLdb, the problem with this connector is that it is complicated to install on Windows!
I am creating this article for those who want to install MySQLdb for Python 3 for Windows. Especially me, since each time I am doing a Python project that needs to connect to MariaDB or MySQL I always look on how to install MySQLdb.
If you are interested why I prefer MySQLdb compared to other MySQL connectors you may want to read the comparison of MySQL-connector and MySQLdb from Charles Nagy.
Problems with installing MySQLdb on Windows
You can actually install MySQLdb using pip. See pypi documentation here.
pip install MySQL-python
Unfortunately, the pypi documentation is already out of date with the latest release was on Jan 3, 2014. Continue reading Installing MySQLdb for Python 3 in Windows
Editing configuration values inside the code is a high risk for error since there is a high chance that not only the values that you are changing you will change, you might even delete a letter or edit a line. In order to avoid this risk, you want your code to be able to accept configuration values at run time. This is extremely useful when developing codes on different environments like development, testing and production.
With AWS Lambda you can reuse your code on different environments using the Environment Variables.
Below is the way to use Environment Variables on AWS Lambda Console using Python 3.6.
Note: This is the same way to use Environment Variables on Python 2.7 and Python 3.7.
Environment Variables Setup
The Environment Variables section can be found under the Function Code section.
Environment Variables are Key/Value Pairs. The Key is what you will use on your Lambda Code, to access its Value. Continue reading AWS Lambda Console: Accessing Environment Variables via Python