Close Menu
    Main Menu
    • Home
    • News
    • Tech
    • Robotics
    • ML & Research
    • AI
    • Digital Transformation
    • AI Ethics & Regulation
    • Thought Leadership in AI

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Prison IP to Showcase ASM and CTI Improvements at GovWare 2025 in Singapore

    October 14, 2025

    OpenAI and Broadcom Announce Strategic Collaboration to Deploy 10 Gigawatts of Customized AI Accelerators by 2029

    October 14, 2025

    Futures of Work ~ Constructing Higher Techniques for Survivors of Exploitation

    October 14, 2025
    Facebook X (Twitter) Instagram
    UK Tech InsiderUK Tech Insider
    Facebook X (Twitter) Instagram
    UK Tech InsiderUK Tech Insider
    Home»Machine Learning & Research»Implement a safe MLOps platform primarily based on Terraform and GitHub
    Machine Learning & Research

    Implement a safe MLOps platform primarily based on Terraform and GitHub

    Oliver ChambersBy Oliver ChambersOctober 12, 2025No Comments11 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    Implement a safe MLOps platform primarily based on Terraform and GitHub
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    Machine studying operations (MLOps) is the mix of individuals, processes, and expertise to productionize ML use instances effectively. To attain this, enterprise prospects should develop MLOps platforms to assist reproducibility, robustness, and end-to-end observability of the ML use case’s lifecycle. These platforms are primarily based on a multi-account setup by adopting strict safety constraints, improvement greatest practices similar to computerized deployment utilizing steady integration and supply (CI/CD) applied sciences, and allowing customers to work together solely by committing adjustments to code repositories. For extra details about MLOps greatest practices, consult with the MLOps basis roadmap for enterprises with Amazon SageMaker.

    Terraform by HashiCorp has been embraced by many shoppers as the primary infrastructure as code (IaC) strategy to develop, construct, deploy, and standardize AWS infrastructure for multi-cloud options. Moreover, improvement repositories and CI/CD applied sciences similar to GitHub and GitHub Actions, respectively, have been adopted broadly by the DevOps and MLOps group internationally.

    On this put up, we present the right way to implement an MLOps platform primarily based on Terraform utilizing GitHub and GitHub Actions for the automated deployment of ML use instances. Particularly, we deep dive on the required infrastructure and present you the right way to make the most of customized Amazon SageMaker Tasks templates, which include instance repositories that assist information scientists and ML engineers deploy ML companies (similar to an Amazon SageMaker endpoint or batch remodel job) utilizing Terraform. You will discover the supply code within the following GitHub repository.

    Answer overview

    The MLOps structure answer creates the required assets to construct a complete coaching pipeline, registering the fashions within the Amazon SageMaker Mannequin Registry, and its deployment to preproduction and manufacturing environments. This foundational infrastructure permits a scientific strategy to ML operations, offering a sturdy framework that streamlines the journey from mannequin improvement to deployment.

    The top-users (information scientists or ML engineers) will choose the group SageMaker Challenge template that matches their use case. SageMaker Tasks helps organizations arrange and standardize developer environments for information scientists and CI/CD methods for MLOps engineers. The mission deployment creates, from the GitHub templates, a GitHub personal repository and CI/CD assets that information scientists can customise in keeping with their use case. Relying on the chosen SageMaker mission, different project-specific assets may also be created.

    Customized SageMaker Challenge template

    SageMaker tasks deploys the related AWS CloudFormation template of the AWS Service Catalog product to provision and handle the infrastructure and assets required to your mission, together with the mixing with a supply code repository.

    On the time of writing, 4 customized SageMaker Tasks templates can be found for this answer:

    • MLOps template for LLM coaching and analysis – An MLOps sample that exhibits a easy one-account Amazon SageMaker Pipelines setup for giant language fashions (LLMs) This template helps fine-tuning and analysis.
    • MLOps template for mannequin constructing and coaching – An MLOps sample that exhibits a easy one-account SageMaker Pipelines setup. This template helps mannequin coaching and analysis.
    • MLOps template for mannequin constructing, coaching, and deployment – An MLOps sample to coach fashions utilizing SageMaker Pipelines and deploy the educated mannequin into preproduction and manufacturing accounts. This template helps real-time inference, batch inference pipelines, and bring-your-own-containers (BYOC).
    • MLOps template for selling the total ML pipeline throughout environments – An MLOps sample to point out the right way to take the identical SageMaker pipeline throughout environments from dev to prod. This template helps a pipeline for batch inference.

    Every SageMaker mission template has related GitHub repository templates which might be cloned for use to your use case:

    SageMaker project creation UI displaying MLOps templates for model lifecycle automation, with associated Git repository types

    When a customized SageMaker mission is deployed by an information scientist, the related GitHub template repositories are cloned by means of an invocation of the AWS Lambda operate

    _clone_repo_lambda, which creates a brand new GitHub repository to your mission.

    Multi-project deployment architecture showing how shared GitHub templates propagate through AWS dev accounts to create standardized project structures

    Infrastructure Terraform modules

    The Terraform code, discovered underneath base-infrastructure/terraform, is structured with reusable modules which might be used throughout totally different deployment environments. Their instantiation can be discovered for every setting underneath base-infrastructure/terraform//principal.tf. There are seven key reusable modules:

    There are additionally some environment-specific assets, which will be discovered immediately underneath base-infrastructure/terraform/.

    Enterprise AWS ML platform architecture with segregated VPCs, role-based access controls, and service connections for Dev/Pre-Prod/Prod environments

    Stipulations

    Earlier than you begin the deployment course of, full the next three steps:

    1. Put together AWS accounts to deploy the platform. We suggest utilizing three AWS accounts for 3 typical MLOps environments: experimentation, preproduction, and manufacturing. Nonetheless, you possibly can deploy the infrastructure to only one account for testing functions.
    2. Create a GitHub group.
    3. Create a private entry token (PAT). It’s endorsed to create a service or platform account and use its PAT.

    Bootstrap your AWS accounts for GitHub and Terraform

    Earlier than we will deploy the infrastructure, the AWS accounts you’ve vended must be bootstrapped. That is required in order that Terraform can handle the state of the assets deployed. Terraform backends allow safe, collaborative, and scalable infrastructure administration by streamlining model management, locking, and centralized state storage. Due to this fact, we deploy an S3 bucket and Amazon DynamoDB desk for storing states and locking consistency checking.

    Bootstrapping can also be required in order that GitHub can assume a deployment function in your account, due to this fact we deploy an IAM function and OpenID Join (OIDC) identification supplier (IdP). As an alternative choice to using long-lived IAM person entry keys, organizations can implement an OIDC IdP inside your AWS account. This configuration facilitates the utilization of IAM roles and short-term credentials, enhancing safety and adherence to greatest practices.

    You’ll be able to select from two choices to bootstrap your account: a bootstrap.sh Bash script and a bootstrap.yaml CloudFormation template, each saved on the root of the repository.

    Bootstrap utilizing a CloudFormation template

    Full the next steps to make use of the CloudFormation template:

    1. Ensure that the AWS Command Line Interface (AWS CLI) is put in and credentials are loaded for the goal account that you just wish to bootstrap.
    2. Determine the next:
      1. Setting sort of the account: dev, preprod, or prod.
      2. Title of your GitHub group.
      3. (Elective) Customise the S3 bucket identify for Terraform state recordsdata by selecting a prefix.
      4. (Elective) Customise the DynamoDB desk identify for state locking.
    3. Run the next command, updating the main points from Step 2:
    # Replace
    export ENV=xxx
    export GITHUB_ORG=xxx
    # Elective
    export TerraformStateBucketPrefix=terraform-state
    export TerraformStateLockTableName=terraform-state-locks
    
    aws cloudformation create-stack 
      --stack-name YourStackName 
      --template-body file://bootstrap.yaml 
      --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM 
      --parameters ParameterKey=Setting,ParameterValue=$ENV 
                   ParameterKey=GitHubOrg,ParameterValue=$GITHUB_ORG 
                   ParameterKey=OIDCProviderArn,ParameterValue="" 
                   ParameterKey=TerraformStateBucketPrefix,ParameterValue=$TerraformStateBucketPrefix 
                   ParameterKey=TerraformStateLockTableName,ParameterValue=$TerraformStateLockTableName

    Bootstrap utilizing a Bash script

    Full the next steps to make use of the Bash script:

    1. Ensure that the AWS CLI is put in and credentials are loaded for the goal account that you just wish to bootstrap.
    2. Determine the next:
      1. Setting sort of the account: dev, preprod, or prod.
      2. Title of your GitHub group.
      3. (Elective) Customise the S3 bucket identify for Terraform state recordsdata by selecting a prefix.
      4. (Elective) Customise the DynamoDB desk identify for state locking.
    3. Run the script (bash ./bootstrap.sh) and enter the main points from Step 2 when prompted. You’ll be able to go away most of those choices as default.

    In the event you change the TerraformStateBucketPrefix or TerraformStateLockTableName parameters, it’s essential to replace the setting variables (S3_PREFIX and DYNAMODB_PREFIX) within the deploy.yml file to match.

    Arrange your GitHub group

    Within the remaining step earlier than infrastructure deployment, it’s essential to configure your GitHub group by cloning code from this instance into particular places.

    Base infrastructure

    Create a brand new repository in your group that can include the bottom infrastructure Terraform code. Give your repository a singular identify, and transfer the code from this instance’s base-infrastructure folder into your newly created repository. Ensure that the .github folder can also be moved to the brand new repository, which shops the GitHub Actions workflow definitions. GitHub Actions make it doable to automate, customise, and execute your software program improvement workflows proper in your repository. On this instance, we use GitHub Actions as our most popular CI/CD tooling.

    Subsequent, arrange some GitHub secrets and techniques in your repository. Secrets and techniques are variables that you just create in a company, repository, or repository setting. The secrets and techniques that you just create can be found to make use of in our GitHub Actions workflows. Full the next steps to create your secrets and techniques:

    1. Navigation to the bottom infrastructure repository.
    2. Select Settings, Secrets and techniques and Variables, and Actions.
    3. Create two secrets and techniques:
      1. AWS_ASSUME_ROLE_NAME – That is created within the bootstrap script with the default identify aws-github-oidc-role, and must be up to date within the secret with whichever function identify you select.
      2. PAT_GITHUB – That is your GitHub PAT token, created within the prerequisite steps.

    Template repositories

    The template-repos folder of our instance incorporates a number of folders with the seed code for our SageMaker Tasks templates. Every folder must be added to your GitHub group as a personal template repository. Full the next steps:

    1. Create the repository with the identical identify as the instance folder, for each folder within the template-repos listing.
    2. Select Settings in every newly created repository.
    3. Choose the Personal Template possibility.

    Be sure you transfer all of the code from the instance folder to your personal template, together with the .github folder.

    Replace the configuration file

    On the root of the bottom infrastructure folder is a config.json file. This file permits the multi-account, multi-environment mechanism. The instance JSON construction is as follows:

    {
      "environment_name": {
        "area": "X",
        "dev_account_number": "XXXXXXXXXXXX",
        "preprod_account_number": "XXXXXXXXXXXX",
        "prod_account_number": "XXXXXXXXXXXX"
      }
    }

    On your MLOps setting, merely change the identify of environment_name to your required identify, and replace the AWS Area and account numbers accordingly. Observe the account numbers will correspond to the AWS accounts you bootstrapped. This config.json allows you to vend as many MLOps platforms as you need. To take action, merely create a brand new JSON object within the file with the respective setting identify, Area, and bootstrapped account numbers. Then find the GitHub Actions deployment workflow underneath .github/workflows/deploy.yaml and add your new setting identify inside every listing object within the matrix key. After we deploy our infrastructure utilizing GitHub Actions, we use a matrix deployment to deploy to all our environments in parallel.

    Deploy the infrastructure

    Now that you’ve arrange your GitHub group, you’re able to deploy the infrastructure into the AWS accounts. Modifications to the infrastructure will deploy mechanically when adjustments are made to the primary department, due to this fact if you make adjustments to the config file, this could set off the infrastructure deployment. To launch your first deployment manually, full the next steps:

    1. Navigate to your base infrastructure repository.
    2. Select the Actions tab.
    3. Select Deploy Infrastructure.
    4. Select Run Workflow and select your required department for deployment.

    This can launch the GitHub Actions workflow for deploying the experimentation, preproduction, and manufacturing infrastructure in parallel. You’ll be able to visualize these deployments on the Actions tab.

    Now your AWS accounts will include the required infrastructure to your MLOps platform.

    Finish-user expertise

    The next demonstration illustrates the end-user expertise.

    Clear up

    To delete the multi-account infrastructure created by this instance and keep away from additional fees, full the next steps:

    1. Within the improvement AWS account, manually delete the SageMaker tasks, SageMaker area, SageMaker person profiles, Amazon Elastic File Service (Amazon EFS) storage, and AWS safety teams created by SageMaker.
    2. Within the improvement AWS account, you may want to supply further permissions to the launch_constraint_role IAM function. This IAM function is used as a launch constraint. Service Catalog will use this permission to delete the provisioned merchandise.
    3. Within the improvement AWS account, manually delete the assets like repositories (Git), pipelines, experiments, mannequin teams, and endpoints created by SageMaker Tasks.
    4. For preproduction and manufacturing AWS accounts, manually delete the S3 bucket ml-artifacts-- and the mannequin deployed by means of the pipeline.
    5. After you full these adjustments, set off the GitHub workflow for destroying.
    6. If the assets aren’t deleted, manually delete the pending assets.
    7. Delete the IAM person that you just created for GitHub Actions.
    8. Delete the key in AWS Secrets and techniques Supervisor that shops the GitHub private entry token.

    Conclusion

    On this put up, we walked by means of the method of deploying an MLOps platform primarily based on Terraform and utilizing GitHub and GitHub Actions for the automated deployment of ML use instances. This answer successfully integrates 4 customized SageMaker Tasks templates for mannequin constructing, coaching, analysis and deployment with particular SageMaker pipelines. In our state of affairs, we centered on deploying a multi-account and multi-environment MLOps platform. For a complete understanding of the implementation particulars, go to the GitHub repository.


    In regards to the authors

    Author picture: Jordan GrubbJordan Grubb is a DevOps Architect at AWS, specializing in MLOps. He permits AWS prospects to realize their enterprise outcomes by delivering automated, scalable, and safe cloud architectures. Jordan can also be an inventor, with two patents inside software program engineering. Outdoors of labor, he enjoys taking part in most sports activities, touring, and has a ardour for well being and wellness.

    Author picture: Irene Arroyo DelgadoIrene Arroyo Delgado is an AI/ML and GenAI Specialist Answer at AWS. She focuses on bringing out the potential of generative AI for every use case and productionizing ML workloads, to realize prospects’ desired enterprise outcomes by automating end-to-end ML lifecycles. In her free time, Irene enjoys touring and mountaineering.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Oliver Chambers
    • Website

    Related Posts

    Remodeling the bodily world with AI: the subsequent frontier in clever automation 

    October 14, 2025

    Constructing Pure Python Net Apps with Reflex

    October 14, 2025

    The Architect’s Dilemma – O’Reilly

    October 14, 2025
    Top Posts

    Evaluating the Finest AI Video Mills for Social Media

    April 18, 2025

    Utilizing AI To Repair The Innovation Drawback: The Three Step Resolution

    April 18, 2025

    Midjourney V7: Quicker, smarter, extra reasonable

    April 18, 2025

    Prison IP to Showcase ASM and CTI Improvements at GovWare 2025 in Singapore

    October 14, 2025
    Don't Miss

    Prison IP to Showcase ASM and CTI Improvements at GovWare 2025 in Singapore

    By Declan MurphyOctober 14, 2025

    Torrance, United States, October 14th, 2025, CyberNewsWirePrison IP at Sales space J30 | Sands Expo…

    OpenAI and Broadcom Announce Strategic Collaboration to Deploy 10 Gigawatts of Customized AI Accelerators by 2029

    October 14, 2025

    Futures of Work ~ Constructing Higher Techniques for Survivors of Exploitation

    October 14, 2025

    Remodeling the bodily world with AI: the subsequent frontier in clever automation 

    October 14, 2025
    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    UK Tech Insider
    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms Of Service
    • Our Authors
    © 2025 UK Tech Insider. All rights reserved by UK Tech Insider.

    Type above and press Enter to search. Press Esc to cancel.