AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Updates a generated template. This can be used to change the name, add and remove
resources, refresh resources, and change the DeletionPolicy
and UpdateReplacePolicy
settings. You can check the status of the update to the generated template using the
DescribeGeneratedTemplate
API action.
For .NET Core this operation is only available in asynchronous form. Please refer to UpdateGeneratedTemplateAsync.
Namespace: Amazon.CloudFormation
Assembly: AWSSDK.CloudFormation.dll
Version: 3.x.y.z
public abstract UpdateGeneratedTemplateResponse UpdateGeneratedTemplate( UpdateGeneratedTemplateRequest request )
Container for the necessary parameters to execute the UpdateGeneratedTemplate service method.
Exception | Condition |
---|---|
AlreadyExistsException | The resource with the name requested already exists. |
GeneratedTemplateNotFoundException | The generated template was not found. |
LimitExceededException | The quota for the resource has already been reached. For information about resource and stack limitations, see CloudFormation quotas in the CloudFormation User Guide. |
This example updates a generated template with a new name.
var client = new AmazonCloudFormationClient(); var response = client.UpdateGeneratedTemplate(new UpdateGeneratedTemplateRequest { GeneratedTemplateName = "JazzyTemplate", NewGeneratedTemplateName = "JazzierTemplate" }); string generatedTemplateId = response.GeneratedTemplateId;
This example removes resources from a generated template
var client = new AmazonCloudFormationClient(); var response = client.UpdateGeneratedTemplate(new UpdateGeneratedTemplateRequest { GeneratedTemplateName = "JazzyTemplate", RemoveResources = new List<string> { "LogicalResourceId1", "LogicalResourceId2" } }); string generatedTemplateId = response.GeneratedTemplateId;
This example adds resources to a generated template
var client = new AmazonCloudFormationClient(); var response = client.UpdateGeneratedTemplate(new UpdateGeneratedTemplateRequest { AddResources = new List<ResourceDefinition> { new ResourceDefinition { ResourceIdentifier = new Dictionary<string, string> { { "BucketName", "jazz-bucket" } }, ResourceType = "AWS::S3::Bucket" }, new ResourceDefinition { ResourceIdentifier = new Dictionary<string, string> { { "DhcpOptionsId", "random-id123" } }, ResourceType = "AWS::EC2::DHCPOptions" } }, GeneratedTemplateName = "JazzyTemplate" }); string generatedTemplateId = response.GeneratedTemplateId;
.NET Framework:
Supported in: 4.5 and newer, 3.5