Create EBS Snapshots with Automation | Best Trigger Methods

Automate Creation of EBS Snapshots

Prev Question Next Question

Question

You have a requirement to automate the creation of EBS Snapshots.

You need to create a trigger for this activity.

Which of the following can be used to achieve this in the best way possible?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - D.

The best is to use the inbuilt service from Cloudwatch, as Cloudwatch Events automate the creation of EBS Snapshots.

With.

Option A, you would be restricted to running the powrshell script on Windows machines and maintaining the script itself.

And then you have the overhead of having a separate instance just to run that script.

When you go to Cloudwatch events, you can use the Target as EC2 CreateSnapshot API call as shown below.

The AWS Documentation mentions.

Amazon CloudWatch Events delivers a near real-time stream of system events that describe changes in Amazon Web Services (AWS) resources.

Using simple rules that you can quickly set up, you can match events and route them to one or more target functions or streams.

CloudWatch Events becomes aware of operational changes as they occur.

CloudWatch Events responds to these operational changes and takes corrective action as necessary by sending messages to respond to the environment, activating functions, making changes, and capturing state information.

For more information on Cloudwatch Events, please visit the below URL:

http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/WhatIsCloudWatchEvents.html
Create rules to invoke Targets based on Events happening in your AWS environment.

Event Source Targets

Build or customize an Event Pattern or set a Schedule to invoke Targets. Select Target to invoke when an event matches your Event Pattern or when

schedule is triggered.
Event Patten @ @) Schedule @

Lambda function yr) @
@ Fixedrateof 5 Minutes

CodePipeline

Cron expression 0/5 * * * ? *

Leam more about ClousWatch Events schedules.
» Show sample event(s)

task
ent bus in an

* Required Kinesis stream

Option D is the correct answer: Use Cloudwatch Events to trigger the snapshots of EBS Volumes.

Explanation: To automate the creation of EBS snapshots, we need a trigger that will initiate the snapshot creation process. The four options provided are:

A. Create a PowerShell script that uses the AWS CLI to get the volumes and then run the script as a cron job. B. Use the AWS Config service to create a snapshot of the AWS Volumes. C. Use the AWS CodeDeploy service to create a snapshot of the AWS Volumes. D. Use Cloudwatch Events to trigger the snapshots of EBS Volumes.

Option A is a possible solution but not the best as it requires manual maintenance of the cron job, which can be challenging when there are multiple volumes to snapshot. This solution is also not serverless, and it needs a server to run the PowerShell script.

Option B is not correct since AWS Config is used to assess and audit compliance with best practices, and it does not create EBS snapshots.

Option C is not correct because AWS CodeDeploy is a deployment service that automates code deployments to any instance, including EC2 instances. It does not support EBS snapshot creation.

Option D is the correct answer since Cloudwatch Events can be used to create a rule to trigger EBS snapshot creation based on a schedule or an event such as the creation of an AMI. Cloudwatch Events can be configured to take a specific action, such as running an AWS Lambda function to create the snapshot.

In summary, the best way to automate the creation of EBS snapshots is to use Cloudwatch Events to create a rule that triggers the snapshot creation process.