This lambda function will create AMIs for you and delete old AMIs once number of total images defined will cross.