Tracking System for Web Marketing Campaigns | AWS Certified Solutions Architect - Professional Exam

Marketing Research Company Tracking System

Prev Question Next Question

Question

A marketing research company has developed a tracking system that collects user behavior during web marketing campaigns on behalf of customers worldwide.

The tracking system consists of an Auto Scaling group of EC2 instances behind an ELB.

And the collected data is stored in DynamoDB.

After the campaign is terminated, the tracking system is torn down, and the data is moved to Amazon Redshift, where it is aggregated and used to generate detailed reports.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Answer - C and E.

Option A is incorrect because you need to retain or keep the snapshots of the EBS volumes to launch similar instances in the new region.

Option B is incorrect because a DynamoDB table with the same name can be created in different regions.

They have to be unique in a single region.

Option C is CORRECT because you need to get the name of the Availability Zone based on the region in which the template would be used.

Option D is incorrect because you do not need to define IAM users per region as they are global.

Option E is CORRECT because the AMI ID would be needed to launch similar instances in the new region where the template would be used.

More information on CloudFormation intrinsic functions:

You can use the Fn::GetAZs function of CloudFormation to get the AZ of the region and assign it to the ELB.An example of the Fn::GetAZs function is given below.

{ "Fn::GetAZs" : "" }

{ "Fn::GetAZs" : { "Ref" : "AWS::Region" } }

{ "Fn::GetAZs" : "us-east-1" }

An example of the FindInMap is shown below.

This is useful when you want to get particular values region wise which can be used as parameters.

Since the Launch configuration contains the AMI ID information and the AMI ID is different in different regions, you need to recreate the Launch Configurations based on the AMI ID.{

...

"Mappings" : {

"RegionMap" : {

"us-east-1" : { "32" : "ami-6411e20d", "64" : "ami-7a11e213" },

"us-west-1" : { "32" : "ami-c9c7978c", "64" : "ami-cfc7978a" },

"eu-west-1" : { "32" : "ami-37c2f643", "64" : "ami-31c2f645" },

"ap-southeast-1" : { "32" : "ami-66f28c34", "64" : "ami-60f28c32" },

"ap-northeast-1" : { "32" : "ami-9c03a89d", "64" : "ami-a003a8a1" }

}

},

"Resources" : {

"myEC2Instance" : {

"Type" : "AWS::EC2::Instance",

"Properties" : {

"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "32"]},

"InstanceType" : "m1.small"

}

}

}

}

For more information on the Fn::FindInMap function, please refer to the below link-

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-findinmap.html

Out of the given answers, the most relevant and correct answer for the scenario is option E, which suggests using AWS CloudFormation's built-in Mappings and FindInMap functions to refer to the AMI ID set in the ImageID attribute of the Autoscaling::LaunchConfiguration resource.

Explanation:

The given scenario describes a marketing research company that has developed a tracking system for collecting user behavior data during web marketing campaigns on behalf of customers worldwide. The tracking system is hosted on an Auto Scaling group of EC2 instances behind an ELB, and the collected data is stored in DynamoDB. After the campaign is terminated, the tracking system is torn down, and the data is moved to Amazon Redshift for generating detailed reports.

In this context, the use of AWS CloudFormation can help automate and manage the infrastructure as code. AWS CloudFormation enables creating and managing a collection of related AWS resources, provisioning and updating them in an orderly and predictable fashion. AWS CloudFormation templates are text files written in JSON or YAML format that describe the infrastructure and resources required for an application.

The answer option E suggests using AWS CloudFormation's built-in Mappings and FindInMap functions to refer to the AMI ID set in the ImageID attribute of the Autoscaling::LaunchConfiguration resource. This is a good practice to make the CloudFormation template more modular and reusable, as it allows separating the AMI IDs from the main template code.

Mappings are key-value pairs that can be used to specify values based on a key. Mappings can be used to specify different values for different regions or environments. FindInMap is a function that enables finding a value based on a key and a subkey in a mapping.

For example, the CloudFormation template can define a mapping that associates an AMI ID with an AWS region as follows:

yaml
Mappings: AMIMap: us-east-1: AMI: ami-12345678 us-west-2: AMI: ami-87654321

Then, in the Autoscaling::LaunchConfiguration resource, the ImageId attribute can refer to the AMI ID by using the FindInMap function as follows:

yaml
Resources: MyLaunchConfig: Type: AWS::AutoScaling::LaunchConfiguration Properties: ImageId: !FindInMap [AMIMap, !Ref 'AWS::Region', AMI] # other properties

This way, the AMI ID can be easily changed based on the region or environment without modifying the main template code.

Answer option A, suggesting avoiding deletion policies for EBS snapshots, is not relevant to the given scenario as it is not related to CloudFormation templates.

Answer option B, suggesting using different DynamoDB table names in every target region, is not necessary as DynamoDB tables can have the same name in different regions as long as they are in different AWS accounts.

Answer option C, suggesting using the built-in function of CloudFormation to set the AZ attribute of the ELB resource, is not relevant to the given scenario as the AZ attribute of the ELB resource is set automatically by AWS.

Answer option D, suggesting defining IAM users with the right to start CloudFormation stacks for every target region, is not necessary as IAM users can be defined in a centralized AWS account and used for managing CloudFormation stacks in different regions.