Courseiva

CCNA Sdlc Automation Questions

16 of 316 questions · Page 5/5 · Sdlc Automation topic · Answers revealed

301
Multi-Selectmedium

Which TWO actions can be used to improve the security of a CI/CD pipeline that uses AWS CodePipeline? (Choose two.)

Select 2 answers
A.Enable encryption for artifacts stored in the pipeline's S3 bucket.
B.Use cross-account actions with appropriate IAM roles to limit access.
C.Configure the source action to poll for changes instead of using webhooks.
D.Store secrets in the pipeline environment variables in plain text.
E.Use a single IAM role for all pipeline actions to simplify permissions.
AnswersA, B

By enabling default encryption on the S3 bucket used as CodePipeline's artifact store—or specifying an AWS KMS customer-managed key in the pipeline settings—all build outputs and source artifacts are encrypted at rest with either SSE-S3 or SSE-KMS. This protects sensitive data from unauthorized direct access to the bucket, even if the bucket policy or ACL is misconfigured. Using KMS adds an additional layer of control by letting you restrict which roles can decrypt artifacts and enabling CloudTrail auditing of all decrypt operations.

Why this answer

AWS CodePipeline stores artifacts in an S3 bucket, and enabling default encryption (SSE-S3 or SSE-KMS) ensures that all objects at rest are encrypted, protecting sensitive build outputs and source code from unauthorized access if the bucket is compromised. This is a fundamental security best practice for data at rest in any CI/CD pipeline.

Exam trap

The trap here is that candidates often confuse 'simplifying permissions' (Option E) with security best practices, but the DOP-C02 exam emphasizes least privilege and role separation over convenience.

302
Multi-Selectmedium

A company has a CI/CD pipeline that builds a Docker image and pushes it to Amazon ECR. The build step uses AWS CodeBuild. The engineer wants to ensure that the ECR repository has a lifecycle policy to expire untagged images after 14 days. Which TWO actions are required? (Choose 2.)

Select 2 answers
A.Use the docker tag command to tag images with a timestamp.
B.Create an ECR lifecycle policy for the repository.
C.Add a lifecycle policy rule in the buildspec.yml file.
D.Configure the lifecycle policy in the CodeBuild project settings.
E.Define a rule that expires untagged images after 14 days.
AnswersB, E

Creating an ECR lifecycle policy is the correct action because it automatically applies expiration rules to images in the chosen repository. Lifecycle policies evaluate images based on criteria like tag status and age, then expire matching images for you. They are managed through the ECR service (console, CLI, or SDK), not through the CI/CD build steps, and are the standard mechanism for controlling image retention and storage costs.

Why this answer

ECR lifecycle policies are configured at the repository level, not in CodeBuild or buildspec files. Option E is correct because the rule must specifically target untagged images and set an expiration of 14 days using the `expire` action with `sinceImagePushed` and `countType` set to `sinceImagePushed` and `countNumber` set to 14. Together, these two actions ensure the lifecycle policy exists and contains the correct rule to expire untagged images after 14 days.

Exam trap

The trap here is that candidates confuse where lifecycle policies are configured (ECR repository level) with where build steps are defined (CodeBuild or buildspec), leading them to incorrectly select options that involve CodeBuild or buildspec modifications.

303
MCQeasy

A team uses AWS CodeDeploy to deploy a web application to an Auto Scaling group. The deployment strategy is Blue/Green. During a recent deployment, the new instances passed all health checks, but traffic was not routed to them. What is the most likely reason?

A.The target group associated with the Auto Scaling group is not properly configured to route traffic.
B.The deployment group is not configured to use a load balancer.
C.The Auto Scaling group's lifecycle hook failed to signal readiness.
D.The CodeDeploy agent on the new instances is not installed.
AnswerA

The target group tied to the Auto Scaling group acts as the traffic-routing endpoint for the load balancer. If its health check path, port, or timeout settings are misconfigured—or if it is not attached to the appropriate listener rule—the newly deployed instances will be registered but immediately marked unhealthy and deregistered, so no user traffic reaches them. CodeDeploy itself successfully completes its scripts, but the deployment outcome appears as a routing failure, not an instance-level failure.

Why this answer

In a Blue/Green deployment with CodeDeploy and an Auto Scaling group, traffic routing is handled by a load balancer target group. If the target group is not properly configured to route traffic to the new instances (e.g., missing or incorrect listener rules, deregistration delay, or health check thresholds), the instances may pass health checks but never receive traffic. This is the most likely cause because the deployment succeeded in provisioning and validating the new instances, but the load balancer did not forward requests to them.

Exam trap

The trap here is that candidates often assume health check success guarantees traffic routing, but in AWS, health checks only verify instance readiness; traffic routing depends on separate load balancer listener rules and target group associations.

How to eliminate wrong answers

Option B is wrong because if the deployment group were not configured to use a load balancer, CodeDeploy would not attempt to route traffic via a load balancer at all; the issue described is that traffic was not routed, implying a load balancer is present but misconfigured. Option C is wrong because a lifecycle hook failure would prevent the instance from completing its launch or termination process, typically causing the instance to remain in a 'Pending:Wait' state and fail health checks, not pass them. Option D is wrong because if the CodeDeploy agent were not installed, the deployment would fail during the Install phase on the new instances, and they would not pass health checks or reach the 'Succeeded' state.

304
MCQhard

A company has a CI/CD pipeline using AWS CodePipeline and AWS CodeBuild. The build stage runs unit tests and produces a JUnit report. The pipeline includes a test action that publishes results to an S3 bucket. Recently, the pipeline started failing with the error: 'The action could not be started because the artifact bucket policy is misconfigured.' What is the most likely cause?

A.The S3 bucket has Amazon S3 Transfer Acceleration enabled, which is not supported by CodePipeline.
B.The KMS key used to encrypt the bucket objects has been rotated, causing the pipeline to lose access.
C.The artifact bucket is in a different AWS Region than the pipeline, and cross-region replication is not enabled.
D.The artifact bucket's bucket policy does not grant the necessary permissions to the CodePipeline service role.
AnswerD

The CodePipeline service role must be explicitly listed as a principal in the artifact bucket's bucket policy with permissions like s3:GetObject, s3:PutObject, and s3:ListBucket. If the bucket policy is missing or uses the wrong role ARN, the pipeline gets an AccessDenied error when trying to read or write artifacts. This is the correct root cause because CodePipeline validates bucket access via the bucket policy and the attached IAM role policies.

Why this answer

AWS CodePipeline requires the artifact bucket's bucket policy to grant the CodePipeline service role (or the pipeline's assumed role) permissions to perform actions like s3:GetObject, s3:PutObject, and s3:GetBucketVersioning. When the bucket policy is misconfigured—for example, missing a principal or action—the pipeline's test action cannot start, resulting in the specific error message. This is a common IAM/permissions issue rather than a regional or encryption key problem.

Exam trap

The trap here is that candidates often assume the error is due to KMS key rotation or cross-region issues, but the specific wording 'artifact bucket policy is misconfigured' directly points to an IAM/bucket policy permission problem, not encryption or replication settings.

How to eliminate wrong answers

Option A is wrong because Amazon S3 Transfer Acceleration is fully compatible with CodePipeline; it only affects data transfer speed and does not cause a 'bucket policy misconfigured' error. Option B is wrong because while KMS key rotation can cause access issues if the pipeline's role lacks kms:Decrypt permissions on the new key, the error message explicitly mentions 'artifact bucket policy is misconfigured,' not a KMS-related error. Option C is wrong because cross-region replication is not required for CodePipeline to access an artifact bucket in a different region; CodePipeline can use cross-region actions with proper bucket policies and service roles, and the error is about policy misconfiguration, not replication.

305
Multi-Selectmedium

Which TWO options are valid ways to trigger an AWS CodePipeline execution automatically?

Select 2 answers
A.Create an Amazon CloudWatch Events rule that starts the pipeline on a schedule.
B.Configure an Amazon S3 event notification to invoke the pipeline.
C.Use a git push to the repository via SSH.
D.Set up a manual approval step in the pipeline.
E.Enable AWS CodeBuild to start the pipeline after a build.
AnswersA, B

AWS EventBridge (CloudWatch Events) can be configured with a cron or rate expression to invoke the StartPipelineExecution API action on CodePipeline as a rule target. This provides a fully managed, scheduled trigger for pipelines, commonly used for nightly builds, recurring data syncs, or regular compliance scans. It is a legitimate automated trigger that does not require any external activity, making it ideal for time-based initiation.

Why this answer

Amazon CloudWatch Events (now Amazon EventBridge) can be configured with a cron or rate expression to trigger an AWS CodePipeline execution on a schedule. This is a native integration that directly starts the pipeline without requiring additional compute resources or custom code.

Exam trap

The trap here is that candidates may confuse a git push (which requires a configured webhook) with a direct trigger, or assume that a manual approval step or CodeBuild can initiate the pipeline, when in fact they are actions within the pipeline or require an external event source.

306
MCQeasy

A DevOps engineer is creating an AWS CloudFormation template to deploy a stack that includes an Amazon EC2 instance. The instance needs to be launched in a specific subnet. How should the engineer reference the subnet ID in the template?

A.Hardcode the subnet ID in the template.
B.Use a mapping (Mappings) to define the subnet ID based on the stack name.
C.Define a parameter (Parameters) of type AWS::EC2::Subnet::Id and reference it.
D.Use the Fn::GetAtt function to retrieve the subnet ID from a VPC resource.
AnswerC

Defining a parameter of type AWS::EC2::Subnet::Id lets the caller supply the actual subnet at stack creation or update, and CloudFormation validates that the value is a real subnet ID. Referencing it via Ref keeps the template portable across environments, and the parameter appears in the console or CLI for clear input.

Why this answer

Defining a parameter of type `AWS::EC2::Subnet::Id` allows the CloudFormation template to accept a subnet ID as input at stack creation or update time, making the template reusable across different environments without modification. This approach follows infrastructure-as-code best practices by avoiding hardcoded values and enabling parameterized deployments.

Exam trap

The trap here is that candidates often confuse Fn::GetAtt with the ability to retrieve any resource attribute from any stack, but Fn::GetAtt only works for resources defined in the same template and cannot fetch a subnet ID from an existing VPC resource unless that VPC resource itself outputs the subnet ID.

How to eliminate wrong answers

Option A is wrong because hardcoding the subnet ID makes the template environment-specific and non-portable, violating the principle of reusable infrastructure-as-code. Option B is wrong because Mappings are used to define static lookup tables based on keys like region or environment, not to dynamically accept user-provided subnet IDs; the stack name is not a reliable key for subnet selection. Option D is wrong because Fn::GetAtt retrieves attributes from resources defined within the same template, but if the VPC and subnet are not created in the same stack, there is no resource to reference; even if they were, Fn::GetAtt on a VPC resource returns VPC-level attributes (e.g., VpcId), not a subnet ID.

307
MCQeasy

The exhibit shows a CloudFormation stack event. The stack creation failed with 'Resource creation cancelled'. What is the most likely reason for this cancellation?

A.The stack template contains a syntax error.
B.The IAM role used for stack operations lacks permissions.
C.A stack creation timeout was reached.
D.The stack was manually cancelled by a user or an automation script.
AnswerD

When a user clicks the 'Cancel' button in the CloudFormation console, or an automation script invokes DeleteStack during a creation operation, CloudFormation aborts pending resource creation and emits a 'Resource creation cancelled' event for each in-progress resource. The stack then transitions to ROLLBACK_IN_PROGRESS, destroying any resources that were successfully created before the cancellation. This event reason directly matches the manual or scripted interruption described in the correct answer.

Why this answer

The 'Resource creation cancelled' event in a CloudFormation stack creation indicates that the operation was explicitly halted by a user or an automation script (e.g., via the AWS CLI, Console, or SDK). This is distinct from a timeout or permission error, which would produce different error messages such as 'Resource creation timed out' or 'API: cloudformation:CreateStack Access Denied'.

Exam trap

The trap here is that candidates confuse 'cancelled' with 'timeout' or 'permission failure', but CloudFormation uses distinct error messages for each—'cancelled' always implies an explicit user or automation action, not a system-driven failure.

How to eliminate wrong answers

Option A is wrong because a syntax error in the template would cause a 'Template validation error' or 'Template format error' at the start of stack creation, not a 'Resource creation cancelled' event after resources have begun provisioning. Option B is wrong because insufficient IAM permissions would result in an 'Access Denied' or 'Authorization failure' error for specific API calls, not a cancellation of the entire stack creation. Option C is wrong because a stack creation timeout would produce a 'Resource creation timed out' or 'Stack creation failed due to timeout' message, not a cancellation event.

308
MCQhard

A DevOps engineer is designing a deployment pipeline for a microservices application on Amazon ECS. The team wants to use blue/green deployments with automatic rollback if CloudWatch alarms are triggered during the deployment. Which combination of services and configurations should the engineer use?

A.Use AWS CodeDeploy with a blue/green deployment configuration on the ECS service, and configure automatic rollback when CloudWatch alarms are breached.
B.Use AWS CloudFormation with a ChangeSet and a custom rollback Lambda function triggered by CloudWatch alarms.
C.Use AWS CodeBuild to run a build that creates a new task definition, then update the ECS service manually, and use CloudWatch alarms to trigger a rollback via a Lambda function.
D.Use Amazon ECS service auto scaling with step scaling policies based on CloudWatch alarms.
AnswerA

AWS CodeDeploy natively integrates with ECS blue/green deployments, shifting traffic between original and replacement task sets via a load balancer. Its deployment group accepts CloudWatch alarm configurations, so a breached alarm automatically triggers rollback to the original task set — satisfying the stem's requirement for alarm-driven automatic rollback.

Why this answer

AWS CodeDeploy natively supports blue/green deployments on Amazon ECS services, and you can configure automatic rollback when CloudWatch alarms are triggered, meeting the team's requirements. Option B is incorrect because CloudFormation ChangeSets do not provide native blue/green deployment with automatic rollback based on alarms; custom Lambda functions add complexity. Option C is incorrect because CodeBuild is used for building artifacts, not deploying; manually updating the ECS service and using a Lambda for rollback is not a streamlined solution.

Option D is incorrect because ECS service auto scaling handles scaling based on demand, not deployment strategies like blue/green.

309
MCQeasy

A company uses AWS CodeBuild to compile a Java application. The build specification includes a pre-build phase to download dependencies. Which file defines the commands for each build phase?

A.pipeline.json
B.buildspec.yml
C.config.xml
D.appspec.yml
AnswerB

buildspec.yml is the correct file because AWS CodeBuild automatically looks for a file named buildspec.yml in the root of the source code directory, unless an alternate buildspec file is specified in the build project. This YAML file defines the build phases—install, pre_build, build, and post_build—along with environment variables, artifact output, and cache settings. For a Java application, the `build` phase would contain commands such as `mvn compile` or `gradle build` to compile the source code. Without a valid buildspec, CodeBuild will fail unless an inline buildspec is provided in the project configuration.

Why this answer

In AWS CodeBuild, the build specification file named 'buildspec.yml' defines the commands that CodeBuild runs during each phase of the build process, including the pre-build phase for downloading dependencies. This YAML file is placed in the root of the source code or specified in the build project configuration, and it contains structured sections for install, pre_build, build, and post_build phases. Option B is correct because buildspec.yml is the standard file that CodeBuild uses to orchestrate build commands.

Exam trap

The trap here is that candidates often confuse the build specification file for CodeBuild (buildspec.yml) with the deployment specification file for CodeDeploy (appspec.yml), especially since both services are part of the AWS CI/CD pipeline and have similar naming patterns.

How to eliminate wrong answers

Option A is wrong because pipeline.json is not a file used by AWS CodeBuild; it is associated with AWS CodePipeline for defining pipeline stages and actions, not for specifying build phase commands. Option C is wrong because config.xml is a configuration file commonly used by Jenkins (a different CI/CD tool) for job configuration, not by AWS CodeBuild. Option D is wrong because appspec.yml is used by AWS CodeDeploy to define deployment lifecycle hooks and file mappings, not for CodeBuild build phases.

310
Multi-Selectmedium

A company uses AWS CodePipeline with a source stage from Amazon S3 and a deploy stage to AWS Elastic Beanstalk. The pipeline has been working for months, but recently the deploy stage started failing with the error 'The S3 object does not exist.' The source artifact is uploaded to the S3 bucket by an external system. Which TWO actions should be taken to resolve this issue? (Choose TWO.)

Select 2 answers
A.Ensure the external system does not overwrite the object after the pipeline execution starts.
B.Change the source stage to use AWS CodeCommit instead of S3.
C.Enable versioning on the S3 bucket and configure the pipeline to use the specific version ID.
D.Use server-side encryption with AWS KMS (SSE-KMS) on the S3 bucket.
E.Increase the timeout for the deploy stage in the pipeline.
AnswersA, C

CodePipeline's S3 source action resolves the artifact by object key at the moment the pipeline execution starts. If an external system overwrites or deletes that object during the run, the pipeline may fetch a different revision or fail entirely because the original content no longer exists. Enforcing immutability through a write-once policy or access controls prevents this race condition and guarantees the pipeline operates on a stable artifact.

Why this answer

The deploy stage fails with 'The S3 object does not exist' when the external system overwrites the source artifact after the pipeline execution starts. CodePipeline references the object by its key at the time the pipeline is triggered; if the object is replaced (i.e., deleted and re-uploaded with the same key), the pipeline may attempt to download a version that no longer exists, especially if the S3 bucket is not versioned. Ensuring the external system does not overwrite the object during execution prevents this race condition.

Exam trap

The trap here is that candidates often assume the error is due to a permission or encryption issue (like SSE-KMS) rather than recognizing it as a classic race condition caused by object overwriting in a non-versioned bucket.

311
MCQhard

A DevOps team is implementing a blue/green deployment strategy for a microservice running on Amazon ECS with AWS CodeDeploy. They want to shift 10% of traffic to the new task set for 5 minutes, then shift the remaining 90%. Which deployment configuration should they use?

A.CodeDeployDefault.ECSAllAtOnce
B.CodeDeployDefault.ECSLinear10PercentEvery1Minutes
C.CodeDeployDefault.ECSCanary10Percent5Minutes
D.Custom configuration with 10% initial traffic and 100% after 5-minute interval
AnswerC

The built-in deployment configuration CodeDeployDefault.ECSCanary10Percent5Minutes instructs CodeDeploy to initially route 10% of the load balancer's traffic to the new ECS task set (the green environment) while the remaining 90% continues to go to the blue task set. After a 5-minute waiting period, during which health checks and metrics can be evaluated, CodeDeploy automatically shifts the remaining 90% of traffic to green, completing the deployment. This two-step canary pattern exactly satisfies the requirement for a 10% initial shift with a 5-minute soak before the final 90% cutover.

Why this answer

The built-in configuration `CodeDeployDefault.ECSCanary10Percent5Minutes` shifts 10% of traffic to the new task set, holds for 5 minutes, then shifts the remaining 90%. This matches the requirement exactly. A custom configuration (D) is unnecessary and not a standard deployment configuration.

Exam trap

Candidates often confuse the canary and linear configurations. `CodeDeployDefault.ECSCanary10Percent5Minutes` shifts 10% instantly and then holds for 5 minutes before shifting the rest. The linear configuration, `CodeDeployDefault.ECSLinear10PercentEvery1Minutes`, shifts 10% every minute over 10 minutes without a hold.

How to eliminate wrong answers

Option A is wrong because CodeDeployDefault.ECSAllAtOnce shifts 100% of traffic to the new task set immediately, which does not match the 10% then 90% gradual shift requirement. Option B is wrong because CodeDeployDefault.ECSLinear10PercentEvery1Minutes shifts 10% of traffic every 1 minute until 100%, resulting in a linear progression over 10 minutes, not a 5-minute wait at 10% followed by a single 90% shift. Option C is wrong because CodeDeployDefault.ECSCanary10Percent5Minutes shifts 10% for 5 minutes and then automatically shifts the remaining 90% immediately after the 5-minute interval, which does not allow the 5-minute hold at 10% before the final shift as specified; it completes the deployment in one canary step.

312
Multi-Selecthard

A DevOps engineer is building a CI/CD pipeline for a PHP application that uses Amazon RDS for MySQL. The pipeline must run database migrations as part of the deployment. The team wants to ensure that if a migration fails, the deployment is rolled back and the database is restored to its previous state. Which THREE steps should the engineer implement?

Select 3 answers
A.Take a snapshot of the RDS database before the migration.
B.Use CloudFormation with a custom resource to run the migration.
C.Use CodeDeploy's AppSpec file to run a migration script in the AfterInstall lifecycle hook.
D.Use AWS Database Migration Service (DMS) to replicate the database continuously.
E.Configure the CodeDeploy deployment group to automatically roll back on failure.
AnswersA, C, E

A manual RDS snapshot taken immediately before the migration is the only mechanism that provides a point-in-time, database-level restore point independent of the application deployment. If the migration script corrupts data or fails mid-transaction, you can restore the instance from this snapshot and redeploy the previous code version, ensuring a clean rollback. This is the standard pre-migration practice because other options either target application code only or do not give you a deterministic restore point for the database itself.

Why this answer

Taking a manual snapshot of the RDS database before the migration provides a reliable restore point. If the migration fails, you can restore the database from this snapshot to its previous state, ensuring data integrity and enabling a clean rollback.

Exam trap

The trap here is that candidates might think AWS DMS is suitable for rollback scenarios, but DMS is for ongoing replication, not for capturing a pre-migration state; the correct approach is to use RDS snapshots combined with CodeDeploy's automatic rollback feature.

313
MCQmedium

A company uses AWS CloudFormation to manage infrastructure as code. They have a stack that creates an Amazon RDS database instance. The database password is stored as a parameter in AWS Systems Manager Parameter Store. The CloudFormation template references the parameter using the 'resolve:ssm' dynamic reference. Recently, a security audit found that the password was exposed in plaintext in the CloudFormation stack outputs. The team wants to prevent sensitive information from being displayed in stack outputs or logs. Which approach should be taken?

A.Set the 'NoEcho' property to 'true' for the parameter in the template
B.Store the password in AWS Secrets Manager and reference it in the template
C.Remove the output from the CloudFormation stack
D.Encrypt the output value using AWS KMS
AnswerC

Removing the output from the CloudFormation stack is the only direct way to prevent the password from being exposed in the stack's output section. Outputs are stored in plaintext by CloudFormation and are retrievable via the console, APIs such as DescribeStacks, and any logging that captures API responses. By eliminating the output, you ensure that the password does not appear in that specific exposure path; additional best practices like using Secrets Manager for retrieval by applications should still be implemented to protect the secret throughout its lifecycle.

Why this answer

The exposure occurred because the sensitive value was placed in the CloudFormation stack Outputs section, which is always visible in plaintext via the console, CLI (describe-stacks), and API regardless of NoEcho or KMS. The only reliable fix is to remove the sensitive value from Outputs entirely and instead surface it through a secure channel such as Secrets Manager, SSM Parameter Store (SecureString), or a custom resource. NoEcho only masks parameter values in the console/API during stack operations — it does not protect Outputs.

Exam trap

DOP-C02 often tests the misconception that NoEcho protects a value everywhere in the template — candidates must remember NoEcho only masks parameters during stack operations and does nothing for Outputs, which are always plaintext.

How to eliminate wrong answers

Option A is wrong because NoEcho only masks the parameter value in the CloudFormation console and API responses during stack create/update events; it does NOT redact the value if that parameter is later referenced in Outputs, which are always returned in plaintext. Option B is wrong because storing the password in Secrets Manager is a good practice for retrieval, but if the template still emits the secret value in Outputs, the exposure persists — the root cause is the Output, not the storage backend. Option D is wrong because CloudFormation Outputs do not support KMS encryption; you cannot 'encrypt an output value' — outputs are plaintext strings returned by describe-stacks, and any attempt to encrypt would just emit ciphertext that the consumer must decrypt out-of-band.

314
MCQhard

A DevOps engineer is reviewing the CodePipeline structure above. The pipeline fails during the Deploy stage with an error: 'The deployment group could not be found.' What is the most likely cause?

A.The pipeline is configured as a single-region pipeline, but the Deploy action is in a different region.
B.The source artifact is not accessible from us-west-2.
C.The CodeDeploy application does not exist in us-west-2.
D.The CodeBuild project is not configured to output artifacts.
AnswerA

In CodePipeline, every pipeline is bound to a single region. If a Deploy action references a CodeDeploy application in another region, it is treated as a cross-region action and must be explicitly configured with the Region property. Without that, the pipeline attempts to execute the action in us-east-1, where no deployment group exists, producing the 'Deployment group not found' error. The fix is to add the cross-region configuration or move the Deploy action to the same region.

Why this answer

The error 'The deployment group could not be found' indicates that CodePipeline is attempting to invoke a CodeDeploy deployment in a region where the specified deployment group does not exist. If the pipeline is configured as a single-region pipeline (e.g., in us-east-1) but the Deploy action references a deployment group in a different region (e.g., us-west-2), CodePipeline will fail because it cannot resolve the deployment group across regions in a single-region pipeline configuration. Cross-region actions require explicit cross-region action configuration in the pipeline structure.

Exam trap

The trap here is that candidates often confuse the error message 'deployment group could not be found' with the deployment group not existing at all (Option C), rather than recognizing it as a region mismatch issue where the deployment group exists but in a different region than the pipeline.

How to eliminate wrong answers

Option B is wrong because the source artifact's accessibility from us-west-2 would cause a different error, such as 'Artifact not found' or 'Access denied', not a deployment group not found error. Option C is wrong because if the CodeDeploy application did not exist in us-west-2, the error would be 'The application could not be found' or 'Application does not exist', not specifically about the deployment group. Option D is wrong because a CodeBuild project not configured to output artifacts would cause the pipeline to fail earlier in the Build stage or during artifact retrieval, not during the Deploy stage with a deployment group error.

315
MCQmedium

A company uses AWS Elastic Beanstalk for deploying a web application. The development team wants to implement a blue/green deployment strategy to minimize downtime. Which approach should they use?

A.Update the Auto Scaling group launch configuration and gradually replace instances.
B.Create a new CodeDeploy deployment group and use the blue/green deployment configuration.
C.Create a new Elastic Beanstalk environment and swap the environment CNAMEs.
D.Create a new target group and register instances from the old environment.
AnswerC

Creating a new Elastic Beanstalk environment and then swapping the environment CNAMEs is the native blue/green deployment method. The new environment is fully provisioned, tested, and warmed up behind its own URL before the CNAME swap atomically redirects production traffic. This enables immediate rollback by swapping back, and it is the standard Elastic Beanstalk pattern for zero-downtime blue/green releases.

Why this answer

In AWS Elastic Beanstalk, blue/green deployment is achieved by creating a separate environment (the green environment) alongside the existing one (the blue environment), deploying the new application version to it, and then swapping the CNAME records of the two environments. This swap is instantaneous at the DNS level, resulting in zero downtime because traffic is immediately redirected from the old environment to the new one without any instance replacement or gradual shifting.

Exam trap

The trap here is that candidates confuse the blue/green deployment mechanism in Elastic Beanstalk (CNAME swap) with the blue/green deployment in AWS CodeDeploy (which uses deployment groups and target groups), leading them to incorrectly select Option B.

How to eliminate wrong answers

Option A is wrong because updating the Auto Scaling group launch configuration and gradually replacing instances describes a rolling update or immutable deployment, not a blue/green deployment, and it does not involve a separate environment or DNS swap. Option B is wrong because CodeDeploy blue/green deployments are used with EC2 instances or Lambda functions, not with Elastic Beanstalk environments; Elastic Beanstalk manages its own deployment mechanisms and does not integrate with CodeDeploy deployment groups for environment-level swaps. Option D is wrong because creating a new target group and registering instances from the old environment is a pattern used with Application Load Balancers for manual traffic shifting, but Elastic Beanstalk abstracts load balancer management and uses environment CNAMEs for traffic routing, not target group swaps.

316
MCQmedium

A DevOps team uses AWS CodePipeline with a multi-branch strategy. The pipeline should deploy to production only from the 'main' branch, but run unit tests for all branches. How should the team configure the pipeline?

A.Configure the pipeline source stage to trigger on all branches, use branch-specific logic in the test stage, and add a manual approval step for production deployment only when the branch is 'main'.
B.Use an AWS Lambda function to check the branch name and invoke different CodePipeline executions for testing and deployment.
C.Create one pipeline with two source stages: one for 'main' and one for all other branches, each with its own test and deploy actions.
D.Create a separate pipeline for each branch, each with identical test and deploy stages.
AnswerA

Configuring the source stage to trigger on all branches is the recommended approach because CodePipeline natively supports branch filters on source actions, allowing a single pipeline to react to every branch push. Branch-specific logic can then be implemented in the test stage using environment variables or run-time conditions to vary test suites, while a manual approval action can be conditionally added to the deploy stage only when the branch is 'main'. This leverages built-in pipeline features, avoids duplication, and keeps the deployment workflow centralized and auditable, which is the most scalable and maintainable design.

Why this answer

AWS CodePipeline supports branch filtering in the source stage to trigger on all branches, and you can use a condition in the deploy stage (e.g., via a Lambda function or a manual approval step) to restrict production deployment to the 'main' branch only. This approach avoids duplicating pipelines while ensuring unit tests run for every branch, meeting the multi-branch strategy requirement efficiently.

Exam trap

The trap here is that candidates may think they need separate pipelines or multiple source stages to handle branch-specific logic, but CodePipeline's branch filtering and conditional actions (like Lambda checks or manual approvals) allow a single pipeline to handle all branches efficiently.

How to eliminate wrong answers

Option B is wrong because invoking separate CodePipeline executions via a Lambda function for testing and deployment adds unnecessary complexity and breaks the single-pipeline model; CodePipeline natively supports branch-based conditions without external orchestration. Option C is wrong because having two source stages in one pipeline is not supported—CodePipeline allows only one source stage per pipeline, and mixing branches in separate source stages would cause conflicts in artifact handling. Option D is wrong because creating a separate pipeline for each branch violates the DRY principle, increases maintenance overhead, and does not leverage CodePipeline's built-in branch filtering and conditional execution capabilities.

← PreviousPage 5 of 5 · 316 questions total

Ready to test yourself?

Try a timed practice session using only Sdlc Automation questions.