-
Notifications
You must be signed in to change notification settings - Fork 11
5. Using Aliases
The deployment framework can work with static and dynamic aliases for referencing deployed resources.
Each alias type usage details are given further in this section.
The static aliases can be used for convenient distinction of infrastructures that are deployed from the same meta descriptions but need to have different resource naming in AWS.
For example, this can be used in setting up similar prod and dev environments, or deploying infrastructure in different regions or accounts.
The static aliases are described in the sdct_aliases.conf file which must be placed in the same directory with the sdct.conf file.
The sdct_aliases.conf includes the key-value list of aliases, for example:
dev_notification_bucket=notification-temp
During the deployment, the name, specified in the meta description as ${dev_notification_bucket} will be replaced with ‘notification-temp’.
The dynamic aliases are used for the cases when you need to reference the IDs of the resources after these resources are deployed.
A dynamic alias is set within the meta description of the AWS resource that influences the alias value. It is described in the apply_changes attribute in the Operation Files.
Currently, dynamic aliases are supported for two types of resources. For each resource type, you need to provide specific details:
IAM Policy alias:
- Action: apply_type: iam_policy
- Dependency name
- Policy Content
IAM Role alias:
- Action: apply_type:iam_role
- Dependency name
- Trusted relationships
The resource name in alias is specified as #{resource_name}. For API Gateway and Cognito, this line is further transformed into a resource ID, generated by AWS during the deployment.
For example (see the screenshot below): you have an IAM policy (1) and an API Gateway (2) described in the deployment_resources.json. After the API gateway is deployed, you need to dynamically update the policy by adding the API Gateway ID which can be retrieved only after the gateway is deployed. To do this, you specify the apply_changes attribute (3) in the API Gateway description. The attribute links the changes to the target policy (4,5) :
The complete deployment_resources.json file with the dynamic alias description can be found in the examples folder.