updating notes
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
# Running notes
|
||||||
|
|
||||||
create an elb with --single and --database
|
create an elb with --single and --database
|
||||||
|
|
||||||
redeploy with username option set, does it change?
|
redeploy with username option set, does it change?
|
||||||
@@ -171,3 +173,75 @@ An example is:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Cloudformation
|
||||||
|
|
||||||
|
<https://adamtheautomator.com/aws-cli-cloudformation/> (example of deploying an S3 bucket with static site `index.html`.)
|
||||||
|
|
||||||
|
To create a cloudformation template you should create a `template.yaml`. This yaml file should have at the top:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
AWSTemplateFormatVersion: 2010-09-09
|
||||||
|
Description: A simple CloudFormation template
|
||||||
|
```
|
||||||
|
|
||||||
|
Then you should add a `Resources` key and populate this with all the infrastructure you need to provision.
|
||||||
|
|
||||||
|
### Creating templates
|
||||||
|
|
||||||
|
Documentation for all AWS resources is: <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html>.
|
||||||
|
|
||||||
|
A good approach is to use the GUI to create an object, and then lookup the cloudformation template as you go along.
|
||||||
|
|
||||||
|
### Deploy a stack/template
|
||||||
|
|
||||||
|
To deploy, you should run the command: `aws cloudformation deploy --template-file template.yaml --stack-name static-website`
|
||||||
|
|
||||||
|
### Failure
|
||||||
|
|
||||||
|
If something goes wrong, you can use `describe-stack-events` and pass the `stack-name` to find the events leading up to the failure: `aws cloudformation describe-stack-events --stack-name strapi-s3`.
|
||||||
|
|
||||||
|
If this is the first time you are creating a stack you will not be able to re-deploy the stack. You must first delete the stack entirely and then re-deploy with any fixes.
|
||||||
|
|
||||||
|
You can delete a stack by running: `aws --profile admin cloudformation delete-stack --stack-name strapi-s3`.
|
||||||
|
|
||||||
|
### Stacks
|
||||||
|
|
||||||
|
<https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/stacks.html>
|
||||||
|
|
||||||
|
A cloudformation stack is a collection of AWS resources that you can manage as a single unit. You can group different resources under one stack then create, update or destroy everything under this stack.
|
||||||
|
|
||||||
|
Using stacks means AWS will treat all resources as a single unit. They must all be created or destroyed successfully to be created or deleted. If a resource cannot be created, Cloudformation will roll the stack back to the previous configuration and delete any interim resources that were created.
|
||||||
|
|
||||||
|
### Snippets
|
||||||
|
|
||||||
|
#### Deploy a template/stack
|
||||||
|
|
||||||
|
`aws --profile admin cloudformation deploy --template-file ./01-stack-storage.yaml --stack-name strapi-s3`
|
||||||
|
|
||||||
|
#### Destroy a stack
|
||||||
|
|
||||||
|
`aws --profile admin cloudformation delete-stack --stack-name strapi-s3`
|
||||||
|
|
||||||
|
## Tags
|
||||||
|
|
||||||
|
Suggested tags for all AWS resources are:
|
||||||
|
|
||||||
|
| Tag | Description | Example |
|
||||||
|
| ----------- | ---------------------------------- | ------------------------ |
|
||||||
|
| git | git repo that contains the code | `web-dev` |
|
||||||
|
| owner | who the resource is for/owned | `home`, `work`, `elliot` |
|
||||||
|
| project | what project it belongs to | `strapi-elb` |
|
||||||
|
| test | flag for a temporary test resource | `true` |
|
||||||
|
| environment | environment resource belongs to | `dev`, `prod` |
|
||||||
|
| deployment | AWS tool used for deployment | `cloudformation`, `elb` |
|
||||||
|
|
||||||
|
### Cloudformation
|
||||||
|
|
||||||
|
For Cloudformation resources the following tags get applied automatically:
|
||||||
|
|
||||||
|
| Tag | Description | Example |
|
||||||
|
| ----------------------------- | ------------------------------- | -------------------------------------------------------------------------------------------------- |
|
||||||
|
| aws:cloudformation:stack-name | stack-name of the resource | `strapi-s3` |
|
||||||
|
| aws:cloudformation:logical-id | resource name given in template | `ELBExampleBucket` |
|
||||||
|
| aws:cloudformation:stack-id | ARN of the cloudformation stack | arn:aws:cloudformation:eu-west-1:745437999005:stack/strapi-s3/459ebbf0-88aa-11ea-beac-02f0c9b42810 |
|
||||||
|
|||||||
4
todo.md
4
todo.md
@@ -1,7 +1,7 @@
|
|||||||
# To Do
|
# To Do
|
||||||
|
|
||||||
Finish S3 config for env vars
|
~~Finish S3 config for env vars~~
|
||||||
Deploy to AWS and ensure vars are working
|
~~Deploy to AWS and ensure vars are working~~
|
||||||
|
|
||||||
Use cloudformation to deploy bucket instead of tieing it to the RDS instance.
|
Use cloudformation to deploy bucket instead of tieing it to the RDS instance.
|
||||||
Use <https://strapi.io/documentation/3.0.0-beta.x/deployment/amazon-aws.html#_2-create-the-bucket> for bucket options for the template.
|
Use <https://strapi.io/documentation/3.0.0-beta.x/deployment/amazon-aws.html#_2-create-the-bucket> for bucket options for the template.
|
||||||
|
|||||||
Reference in New Issue
Block a user