You can define variables and their scope in Azure DevOps pipeline. Variables give you a convenient way to get key bits of data into various parts of the pipeline. The most common use of variables is to define a value that you can then use in your pipeline. All variables are stored as strings and are mutable. The value of a variable can change from run to run or job to job of your pipeline.
The following pipeline can be used to understand the scope of variables defined at root, stage and job level.
In the YAML file, you can set a variable at various scopes:
At the root level, to make it available to all jobs in the pipeline.
At the stage level, to make it available only to a specific stage.
At the job level, to make it available only to a specific job.
When a variable is defined at the top of a YAML, it will be available to all jobs and stages in the pipeline and is a global variable. Global variables defined in a YAML are not visible in the pipeline settings UI.
Variables at the job level override variables at the root and stage level. Variables at the stage level override variables at the root level. A variable set in the pipeline root level will override a variable set in the Pipeline settings UI.
You can build an application, create a docker image and upload it to AWS ECR using Azure DevOps build pipeline. Later deploy this image from AWS ECR to AWS ECS Fargate container using the Release pipeline in Azure DevOps.
AWS provides a set of open-source base images that you can use to create your container image. These base images include a runtime interface client to manage the interaction between Lambda and your function code.