Created
July 30, 2023 11:21
-
-
Save jaeyow/299e29b73904f340eff12cac494ff3b9 to your computer and use it in GitHub Desktop.
Metaflow step that deploys the best model using AWS SAM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@step | |
def deploy_best_model(self): | |
""" | |
Deploy the best model to AWS Lambda using SAM CLI | |
""" | |
try: | |
AWS_REGION = "ap-southeast-2" | |
BASE_PATH = "sam" | |
PROFILE_NAME = "Cevo-Dev.AWSFullAccountAdmin" | |
BEST_MODEL = self.MODEL_PKL_FILENAME | |
sam_command = f"cd {BASE_PATH} && sam build && sam deploy --region {AWS_REGION} \ | |
--profile {PROFILE_NAME} --no-confirm-changeset --parameter-overrides \ | |
'ParameterKey=BestModel,ParameterValue={BEST_MODEL}'" | |
print(sam_command) | |
os.system(sam_command) | |
except Exception as e_xc: | |
print(str(e_xc)) | |
exit(1) | |
self.next(self.end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment