From f5a4e3e7a87a4f3f034296666dfdeab883917c9b Mon Sep 17 00:00:00 2001 From: Manuel Eusebio de Paz Carmona Date: Wed, 22 Apr 2020 13:43:38 +0200 Subject: [PATCH 1/2] Update AWS CloudFormation Template (YAML).yaml.ft Adding a more complex running sample with comments, parameters, outputs and opinionated best practices about UI --- ...AWS CloudFormation Template (YAML).yaml.ft | 69 +++++++++++++++++-- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/CloudFormation/src/main/resources/fileTemplates/internal/AWS CloudFormation Template (YAML).yaml.ft b/CloudFormation/src/main/resources/fileTemplates/internal/AWS CloudFormation Template (YAML).yaml.ft index 9f9cb903b9e..2c5fa27be9e 100644 --- a/CloudFormation/src/main/resources/fileTemplates/internal/AWS CloudFormation Template (YAML).yaml.ft +++ b/CloudFormation/src/main/resources/fileTemplates/internal/AWS CloudFormation Template (YAML).yaml.ft @@ -1,7 +1,66 @@ +# More Cloudformation templates at: https://github.com/awslabs/aws-cloudformation-templates +--- AWSTemplateFormatVersion: "2010-09-09" -Description: -Resources: - DummyServer: - Type: "AWS::EC2::Instance" +Description: 'AWS CloudFormation Sample Template S3_Bucket_With_Encryption_and_Retain_On_Delete: + Sample template showing how to create a protected for public access and encryption configured + it also includes a deletion policy of retain on delete. **WARNING** This + template creates an S3 bucket that will NOT be deleted when the stack is deleted. + You will be billed for the AWS resources used if you create a stack from this template.' + +Metadata: # Optional + License: Apache-2.0 + AWS::CloudFormation::Interface: + ParameterGroups: + - + Label: + default: "Tags applied to the provisioned bucket" + Parameters: + - ProjectName + - OwnerName + ParameterLabels: + - + ProjectName: + default: "What is the name of this project?" + - + OwnerName: + default: "Who is responsible for this project?" + +Parameters: # Optional + ProjectName: + Type: String + Description: A value for the tag Project + + OwnerName: + Type: String + Description: A value for the tag Owner + +Resources: # Required + DummyBucket: + Type: "AWS::S3::Bucket" + DeletionPolicy: Retain Properties: - ImageId: "" + BucketEncryption: + ServerSideEncryptionConfiguration: + - ServerSideEncryptionByDefault: + SSEAlgorithm: AES256 + PublicAccessBlockConfiguration: + BlockPublicAcls: true + BlockPublicPolicy: true + IgnorePublicAcls: true + RestrictPublicBuckets: true + Tags: + - + Key: Project + Value: !Ref ProjectName + - + Key: Owner + Value: !Ref OwnerName + +Outputs: # Optional + DummyBucketName: + Description: Dummy Bucket's name + Value: !Ref DummyBucket + + DummyBucketArn: + Description: Dummy Bucket's ARN + Value: !GetAtt 'DummyBucket.Arn' From 5ca8c0006f76348b9471ea6ccea1266d127147bc Mon Sep 17 00:00:00 2001 From: Manuel Eusebio de Paz Carmona Date: Wed, 22 Apr 2020 14:52:37 +0200 Subject: [PATCH 2/2] Update AWS CloudFormation Template (JSON).template.ft Adding a more complex running sample with comments, parameters, outputs and opinionated best practices about UI --- ...CloudFormation Template (JSON).template.ft | 100 ++++++++++++++++-- 1 file changed, 94 insertions(+), 6 deletions(-) diff --git a/CloudFormation/src/main/resources/fileTemplates/internal/AWS CloudFormation Template (JSON).template.ft b/CloudFormation/src/main/resources/fileTemplates/internal/AWS CloudFormation Template (JSON).template.ft index e9105e84391..932b86b760d 100644 --- a/CloudFormation/src/main/resources/fileTemplates/internal/AWS CloudFormation Template (JSON).template.ft +++ b/CloudFormation/src/main/resources/fileTemplates/internal/AWS CloudFormation Template (JSON).template.ft @@ -1,8 +1,96 @@ { - "AWSTemplateFormatVersion" : "2010-09-09", - - "Description" : "", - - "Resources" : { + "AWSTemplateFormatVersion": "2010-09-09", + "Description": "AWS CloudFormation Sample Template S3_Bucket_With_Encryption_and_Retain_On_Delete:\nSample template showing how to create a protected for public access and encryption configured\nit also includes a deletion policy of retain on delete. **WARNING** This\ntemplate creates an S3 bucket that will NOT be deleted when the stack is deleted.\nYou will be billed for the AWS resources used if you create a stack from this template.", + "Metadata": { + "License": "Apache-2.0", + "AWS::CloudFormation::Interface": { + "ParameterGroups": [ + { + "Label": { + "default": "Tags applied to the provisioned bucket" + }, + "Parameters": [ + "ProjectName", + "OwnerName" + ] + } + ], + "ParameterLabels": [ + { + "ProjectName": { + "default": "What is the name of this project?" + } + }, + { + "OwnerName": { + "default": "Who is responsible for this project?" + } + } + ] + } + }, + "Parameters": { + "ProjectName": { + "Type": "String", + "Description": "A value for the tag Project" + }, + "OwnerName": { + "Type": "String", + "Description": "A value for the tag Owner" + } + }, + "Resources": { + "DummyBucket": { + "Type": "AWS::S3::Bucket", + "DeletionPolicy": "Retain", + "Properties": { + "BucketEncryption": { + "ServerSideEncryptionConfiguration": [ + { + "ServerSideEncryptionByDefault": { + "SSEAlgorithm": "AES256" + } + } + ] + }, + "PublicAccessBlockConfiguration": { + "BlockPublicAcls": true, + "BlockPublicPolicy": true, + "IgnorePublicAcls": true, + "RestrictPublicBuckets": true + }, + "Tags": [ + { + "Key": "Project", + "Value": { + "Ref": "ProjectName" + } + }, + { + "Key": "Owner", + "Value": { + "Ref": "OwnerName" + } + } + ] + } + } + }, + "Outputs": { + "DummyBucketName": { + "Description": "Dummy Bucket's name", + "Value": { + "Ref": "DummyBucket" + } + }, + "DummyBucketArn": { + "Description": "Dummy Bucket's ARN", + "Value": { + "Fn::GetAtt": [ + "DummyBucket", + "Arn" + ] + } + } } -} \ No newline at end of file +}