AWS Proton parameters
You can define and use parameters in your infrastructure as code (IaC) files to make them flexible and re-usable. You read a parameter value in your
IaC files by referring to the parameter's name in the AWS Proton parameter namespace. AWS Proton injects parameter values into the rendered
IaC files that it generates during resource provisioning. To process AWS CloudFormation IaC parameters, AWS Proton uses Jinja
With CodeBuild provisioning, AWS Proton generates an input file that your code can import. The file is a JSON or HCL file, depending on a property in your template's manifest. For more information, see CodeBuild provisioning parameter details and examples.
You can refer to parameters in your environment, service, and component IaC files or provisioning code with the following requirements:
-
The length of each parameter name doesn't exceed 100 characters.
-
The length of the parameter namespace and resource name combined doesn't exceed the character limit for the resource name.
AWS Proton provisioning fails if these quotas are exceeded.
Parameter types
The following parameter types are available to you for reference in AWS Proton IaC files:
- Input parameter
-
Environments and service instances can take input parameters that you define in a schema file that you associate with the environment or service template. You can refer to a resource's input parameters in the resource's IaC file. Component IaC files can refer to input parameters of the service instance that the component is attached to.
AWS Proton checks input parameter names against your schema file, and matches them with the parameters that are referenced in your IaC files to inject the input values that you provide in a spec file during resource provisioning.
- Output parameter
-
You can define outputs in any of your IaC files. An output can be, for example, a name, ID, or ARN of one of the resources that the template provisions, or it can be a way to pass through one of the template's inputs. You can refer to these outputs in IaC files of other resources.
In CloudFormation IaC files,define output parameters in the
Outputs:
block. In a Terraform IaC file, define each output parameter using anoutput
statement. - Resource parameter
-
AWS Proton automatically creates AWS Proton resource parameters. These parameters expose properties of the AWS Proton resource object. An example of a resource parameter is
environment.name
.
Using AWS Proton parameters in your IaC files
To read a parameter value in an IaC file, you refer to the parameter's name in the AWS Proton parameter namespace. For AWS CloudFormation IaC files, you use Jinja syntax and surround the parameter with pairs of curly braces and quotation marks.
The following table shows the reference syntax for each supported template language, with an example.
Template language | Syntax | Example: environment input named "VPC" |
---|---|---|
CloudFormation |
|
|
Terraform |
|
|
Note
If you use CloudFormation dynamic parameters in
your IaC file, you must escape them
The following table lists namespace names for all AWS Proton resource parameters. Each template file type can use a different subset of the parameter namespace.
Template file | Parameter type | Parameter name | Description |
---|---|---|---|
Environment |
resource |
|
Environment name |
input |
|
Schema-defined environment inputs |
|
Service |
resource |
|
Environment name and AWS account ID |
output |
|
Environment IaC file outputs |
|
resource |
|
Service name and code repository |
|
resource |
|
Service instance name |
|
input |
|
Schema-defined service instance inputs |
|
resource |
|
Attached default component name |
|
output |
|
Attached default component IaC file outputs |
|
Pipeline |
resource |
|
Service instance environment name and AWS account ID |
output |
|
Service instance environment IaC file outputs |
|
input |
|
Schema-defined pipeline inputs |
|
resource |
|
Service name and code repository |
|
input |
|
Schema-defined service instance inputs |
|
collection |
|
A collection of service instances that you can loop through |
|
Component |
resource |
|
Environment name and AWS account account ID |
output |
|
Environment IaC file outputs |
|
resource |
|
Service name and code repository (attached components) |
|
resource |
|
Service instance name (attached components) |
|
input |
|
Schema-defined service instance inputs (attached components) |
|
resource |
|
Component name |
For more information and examples, see the subtopics about parameters in IaC template files for different resource types and template languages.
Topics
- Environment CloudFormation IaC file parameter details and examples
- Service CloudFormation IaC file parameter details and examples
- Component CloudFormation IaC file parameter details and examples
- Parameter filters for CloudFormation IaC files
- CodeBuild provisioning parameter details and examples
- Terraform infrastructure as code (IaC) file parameter details and examples