I have RDS instances running in my AWS account created via a Cloudformation template. Recently there was a storage-full occurrence and as immediate remediation, I modified storage size from default 20 GB to 50 GB from the console.
Now I am considering modifying my CFN template so that RDS auto-scaling is enabled. But as I went through the AWS documentation, it says auto-scaling can be enabled through CLI, RDS API, and Console, and no mention about Cloudformation?
Is there any way to enable auto-scaling via Cloudformation?
There is not direct option for that, as explained in the following GitHub issue:
AWS::RDS::DBInstance (add Storage Auto Scaling)
However, it seems that if you set MaxAllocatedStorage, the storage autoscaling will get enabled.
Related
I need to retrieve existing data/properties of a given resource by using an AWS Cloudformation template. Is it possible? If it is how can I do it?
Example 1:
Output: Security Group ID which allows traffic on port 22
Example 2:
Output: Instance ID which use default VPC
AWS CloudFormation is used to deploy infrastructure from a template in a repeatable manner. It cannot provide information on any resources created by any methods outside of CloudFormation.
Your requirements seem more relevant to AWS Config:
AWS Config provides a detailed view of the configuration of AWS resources in your AWS account. This includes how the resources are related to one another and how they were configured in the past so that you can see how the configurations and relationships change over time.
An AWS resource is an entity you can work with in AWS, such as an Amazon Elastic Compute Cloud (EC2) instance, an Amazon Elastic Block Store (EBS) volume, a security group, or an Amazon Virtual Private Cloud (VPC).
Using your examples, AWS Config can list EC2 instances and any resources that are connected to the instances, such as Security Groups and VPCs. You can easily click-through these relationship and view the configurations. It is also possible to view how these configurations have changed over time, such as:
When EC2 instance changed state (eg stopped, running)
When rules changed on Security Groups
Alternatively, you can simply make API calls to AWS services to obtain the current configuration of resources, such as calling DescribeInstances to obtain a list of Amazon EC2 instances and their configurations.
Is it possible to tag AWS Lightsail snapshots?
From Tags in Amazon Lightsail | Lightsail Documentation:
The following Lightsail resources can be tagged in the Lightsail console:
Instances
Databases
Disks
DNS zones
Load balancers
Important: Snapshots created using the Lightsail console automatically inherit tags from the source resource. A Lightsail resource created from that snapshot will have the same tags that were present on the source resource when the snapshot was created.
The following resources can be tagged using the Lightsail API, AWS Command Line Interface (AWS CLI), or SDKs:
Database snapshots
Databases
Disk snapshots
...
So, it appears that tagging Snapshots requires you to use the Lightsail API, or the AWS CLI or programmatically via an SDK.
I used the AWS CLI like this:
aws lightsail tag-resource --resource-name WordPress-1-1620563255 --tags key=Department,value=Finance
The tag does not appear in the Lightsail console, but when I later ran aws lightsail get-instance-snapshots, the tag showed in the response.
As per the 'important' notice above, any tags on the instance will automatically be copied to any Snapshots, so that's probably an easier way to add a tag (if appropriate to your situation).
I am creating a EMR cluster through cloud formation .
I have already created security configuration from AWS management console .
I am not able to find any way where i can add this security config while creating EMR from cloud formation.
Alternatively i can leverage lambda function , but how to add a EMR security configuration after cluster is created ?
any help would be appreciated...
Unfortunately this is not yet possible with cloudformation. Security Configurations were released September of last year and Cloudformation has yet to support it. At this time the only way would be to do it manually after the creation or via the lambda or other method.
As of today, this is only possible using Lambda backed custom resources. This is what you'll need to do on a high-level:
Create EMR cluster using CloudFormation supported AWS::EMR::Cluster resource type.
Define a Lambda backed custom resource, say with resource type Custom::EMRSecurityConfiguration.
Define a Lambda function that'll be used in step #2 and do the needful by using AWS SDK (e.g. boto3 if you're writing your Lambda in Python) and actually create/update/delete the security configuration based on the kind of EventType (the value for this will be passed in by CloudFormation to your function).
Lambda function defined in #3 will be triggered by CloudFormation everytime you create/update/delete the custom resource defined in #2. I'd recommend looking at AWS docs for Lambda-backed custom resources and security configuration.
I want to migrate my existing VPC, subnets etc from one amazon account to another amazon account using cloud formation.
How can i do this?
If you have a CloudFormation template for your VPC environment already, then you can simply create a new stack using that same template in another AWS account.
However, this will create a copy of your VPC environment as it was when it was initially created. Any changes done to the VPC since it was created using CloudFormation will not be included. This will include the acquisition of data in a database, for example.
If you do not already have a CloudFormation template, you can try to create one using AWS Cloud Former. Cloud Former can be used to examine your AWS environment and create a CloudFormation template from what it sees.
Instructions for running AWS Cloud Former can be found in the AWS Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-using-cloudformer.html
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.