Set Administrator Password at CloudFormation Runtime - AWS Certified Database Specialty Exam - DBS-C01 | Amazon

Set Administrator Password at CloudFormation Runtime

Question

A CloudFormation template is being used to deploy an Amazon Redshift cluster.

You want the setting of the administrator password to be done at CloudFormation runtime.

Which CloudFormation section should be used for this requirement?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer: B.

Option A is incorrect because the metadata section is used to provide information about the template.

Option B is CORRECT because the parameters section is used to pass values to the template during CloudFormation runtime.

Option C is incorrect because the mappings section is used to define key and matching value mapping pairs.

Option D is incorrect because the resources section is used to specify resources that should be provisioned by the template.

Reference:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html

The correct answer is B. Parameters.

CloudFormation is an AWS service that allows users to define infrastructure as code (IAC) by creating templates that define resources, dependencies, and configurations in a declarative way. These templates can be used to create, update, and delete AWS resources, including Amazon Redshift clusters.

In this scenario, we want to set the administrator password for the Amazon Redshift cluster at CloudFormation runtime. To achieve this, we can define a parameter in the CloudFormation template for the administrator password. The administrator password parameter can then be passed to the Amazon Redshift cluster resource during deployment.

Here's an example of how this could be done in a CloudFormation template:

yaml
Parameters: AdminPassword: Type: String NoEcho: true Description: The administrator password for the Amazon Redshift cluster. Resources: RedshiftCluster: Type: AWS::Redshift::Cluster Properties: MasterUsername: admin MasterUserPassword: !Ref AdminPassword # Other Amazon Redshift cluster properties...

In this example, we define a parameter called AdminPassword of type String. We set the NoEcho property to true to ensure that the password is not displayed in plain text during CloudFormation deployment.

We then create an Amazon Redshift cluster resource called RedshiftCluster of type AWS::Redshift::Cluster. In the Properties section of the resource, we set the MasterUsername property to admin and the MasterUserPassword property to !Ref AdminPassword. The !Ref function retrieves the value of the AdminPassword parameter during deployment.

Using parameters in this way allows us to set the administrator password at CloudFormation runtime and ensures that the password is not stored in plain text in the CloudFormation template.