How do I create a EBS snapshot without downtime to the instance? - amazon-web-services

Is it possible to create a snapshot of an EBS Volume without downtime via Terraform?
I am currently looking at documentation about resource aws_dlm_lifecycle_policy.
(https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/dlm_lifecycle_policy)

Seems like it is possible. DLM lifecycle policy just automates snapshot creation.
Snapshots are created asynchronously, even from an attached volume which is in use. Consult with official AWS documentation here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html

Related

How to create EC2 AMI with Cloud Formation only before deleting that Cloud Formation stack?

My question here is I will be creating the EC2 instance using the cloud formation template, while deleting the stack I want to create the AMI of that EC2. I found some articles about how to create the AMI using the Cloud Formation template. But before deleting the stack How can I send signal to Cloud Formation to create AMI before deleting that EC2 instance. For RDS, EBS volumes and some others have Deletion policy, where we can specify Retain or snapshot to leave the resource to be deleted or create snapshot of that respectively. Can someone help with this or you if you find some article point me to that direction.
Thank you.
You need a custom resource which responds to the following events:
Supports the Create, Read, Update, Delete, and List (CRUDL) operations

Does AWS Elasticsearch snapshot contains data?

I was reading upon the AWS documentation on Elasticsearch and in the latest versions they take snapshot of the AWS ES Cluster every 1 hour and store it in S3.
This can prove super useful in terms of recovery.
But I could not find if this snapshot just contains the cluster information or the data as well ?
Can someone confirm with if it stores the data as well or just the cluster information ?
Thanks !
From the AWS documentation:
On Amazon Elasticsearch Service, snapshots come in two forms: automated and manual.
Automated snapshots are only for cluster recovery. You can use them to restore your domain in the event of red cluster status or other data loss. Amazon ES stores automated snapshots in a preconfigured Amazon S3 bucket at no additional charge.
Manual snapshots are for cluster recovery or moving data from one cluster to another. As the name suggests, you have to initiate manual snapshots. These snapshots are stored in your own Amazon S3 bucket, and standard S3 charges apply. If you have a snapshot from a self-managed Elasticsearch cluster, you can even use that snapshot to migrate to an Amazon ES domain.
This will support cluster recovery for both and data migration from a manual snapshot. Any networking or configuration of the cluster from within the Elasticsearch service itself is managed entirely via the AWS API so these should be managed via infrastructure as code (such as CloudFormation or Terraform).

Automatically Tag Amazon EBS Snapshots with Tags taken from the Volume

I am looking for a way to tag the Amazon EBS snapshots with the tags of the volumes.
When I am creating a new manual snapshot from an Amazon EBS Volume, it has to be tagged automatically with the Volume Tags.
Please suggest ways to do it.
From Copy Snapshot API now supports adding tags while copying snapshots:
Posted On: Nov 19, 2019
You can now add tags while copying snapshots. Previously, a user had to first copy the snapshot and then add tags to the copied snapshot manually. Moving forward, you can specify the list of tags you wish to be applied to the copied snapshot as a parameter on the Copy Snapshot API.
This allows the tags to be copied when the snapshot is initiated via an API call. For example, you could trigger the snapshot via an AWS CLI command.
If, instead, you wish to automatically copy the tags when the snapshot is triggered via the Amazon EC2 management console, you would either need to manually specify the tags, or write some code that uses Amazon CloudWatch Events to notice that a new snapshot was created and copy the tags (as per #Calvin's answer).
One easy way to do this is by setting up Cloudwatch Events to trigger a Lambda function that will tag your snapshots.
For detailed example of what that might look like, See: How to Automatically Tag Amazon EC2 Resources in Response to API Events | AWS Security Blog

Restore AWS RDS from xtrabackup through CloudFormation

maybe someone could help me.
I have Aurora cluster CloudFormation template ang I'm trying to restore database data from xtrabackup.
I can use this backup through GUI - AWS provide button "Restore Aurora DB cluster from S3". I think, I can do it through CLI, but I need restore this backup from CloudFormation. I found option DBSnapshotIdentifier, but, as I understand, this option works just with RDS Snapshots.
Do we have a way to do it?
Or, maybe I can restore this backup to exist RDS Cluster.
You need to take the backup you used and turn it into an AWS snapshot, so then you can reference it. While AWS Console does this for you it seems that CloudFormation doesn't offer that facility.

EBS volumes on EMR cluster with CloudFormation

I'm trying to launch an EMR cluster using AWS CloudFormation. I'd like to add EBS volumes to my core instances, however neither the AWS::EMR::Cluster nor the AWS::EMR::InstanceGroupConfig resource types mention anything about EBS volumes. I see you can attach EBS volumes via the API, but CloudFormation will not accept these settings.
Is this possible to do via CloudFormation?
The ability to launch Amazon EMR clusters with attached EBS volumes was introduced in February 2016 (a month prior to this question being posted).
It is likely that CloudFormation has not yet been updated to enable this additional configuration. It is quite common for CloudFormation to lag behind new feature releases.
When available, the configuration will likely be added to the Amazon Elastic MapReduce Cluster JobFlowInstancesConfig InstanceGroupConfig.