How do i create a basic aws cloudformation template and cloudformation stack?
-
Level: Beginner
Pre-reqs: AWS account and cli configuration already setup, see: https://www.lightnetics.com/post/1149
AWS cloudformation documentation link to example: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/gettingstarted.templatebasics.html#gettingstarted.templatebasics.whatCloudformation template at most basic level.
Create a file called s3sample.json with this sample cloudformation code.{ "Resources" : { "HelloBucket" : { "Type" : "AWS::S3::Bucket" } } }
Use the cli to create a cloud formation stack.
$ aws cloudformation create-stack --stack-name stack1 --template-body file://s3sample.json
The stack means a stack of resources, templates are a lot more complex than creating a simple S3 bucket, the template contains all the properties, of all the resources and any dependancies between resources. A single stack can be your design for your entire AWS infrastructure projects.
© Lightnetics 2024