Skip to content

Commit

Permalink
Migrate to README.yaml format (#10)
Browse files Browse the repository at this point in the history
* Migrate to README.yaml format
  • Loading branch information
vadim-gleif authored Jul 19, 2018
1 parent 9884528 commit 968ea7e
Show file tree
Hide file tree
Showing 8 changed files with 415 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
.terraform/
*.zip
.idea/

.build-harness
build-harness
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
addons:
apt:
packages:
- git
- make
- curl

install:
- make init

script:
- make terraform/install
- make terraform/get-plugins
- make terraform/get-modules
- make terraform/lint
- make terraform/validate
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
SHELL := /bin/bash

# List of targets the `readme` target should call before generating the readme
export README_DEPS ?= docs/targets.md docs/terraform.md

-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)

## Lint terraform code
lint:
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate

all: lambda_ami_backups.zip lambda_ami_cleanups.zip

%.zip: %.py
zip $@ $<

clean:
rm *.zip
clean::
rm *.zip
233 changes: 216 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
# Terraform module for automatic AMI creation
<!-- This file was automatically generated by the `build-harness`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->

[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com)

# terraform-aws-ec2-ami-backup [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-ec2-ami-backup.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-ec2-ami-backup) [![Latest Release](https://img.shields.io/github/release/cloudposse/terraform-aws-ec2-ami-backup.svg)](https://travis-ci.org/cloudposse/terraform-aws-ec2-ami-backup/releases) [![Slack Community](https://slack.cloudposse.com/badge.svg)](https://slack.cloudposse.com)


This repo contains a terraform module that creates two lambda functions
that will create AMI automatically at regular intervals. It is based on
the code at
<https://serverlesscode.com/post/lambda-schedule-ebs-snapshot-backups/> and
<https://serverlesscode.com/post/lambda-schedule-ebs-snapshot-backups-2/>.


---

This project is part of our comprehensive ["SweetOps"](https://docs.cloudposse.com) approach towards DevOps.




It's 100% Open Source and licensed under the [MIT](LICENSE).







## Usage

Include this repository as a module in your existing terraform code:
Expand All @@ -24,8 +45,12 @@ module "lambda_ami_backup" {
}
```

Example on excluding some of attached EBS volumes:



## Examples

Example on excluding some of attached EBS volumes:
```
module "lambda_ami_backup" {
source = "git::https://github.com/cloudposse/tf_ami_backup.git?ref=tags/0.1.0"
Expand All @@ -45,18 +70,192 @@ module "lambda_ami_backup" {
}
```

## Variables

| Name | Default | Description | Required |
|:----------------------------:|:--------------:|:--------------------------------------------------------:|:--------:|
| namespace | `` | Namespace (e.g. `cp` or `cloudposse`) | Yes |
| stage | `` | Stage (e.g. `prod`, `dev`, `staging` | Yes |
| name | `` | Name (e.g. `bastion` or `db`) | Yes |
| region | `` | AWS Region where module should operate (e.g. `us-east-1`)| Yes |
| ami_owner | `` | AWS Account ID which is used as a filter for AMI list (e.g. `123456789012`)| Yes |
| instance_id | `` | AWS Instance ID which is used for creating the AMI image (e.g. `id-123456789012`)| Yes |
| retention_days | `14` | Is the number of days you want to keep the backups for (e.g. `14`)| No |
| backup_schedule | `cron(00 19 * * ? *)` | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | No |
| cleanup_schedule | `cron(05 19 * * ? *)` | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | No |
| reboot | `false` | Reboot the machine as part of the snapshot process | No |
| block_device_mappings | `[]` | List of block device mappings to be included/excluded from created AMIs. With default value of [], AMIs will include all attached EBS volumes. | No |


## Makefile Targets
```
Available targets:
help This help screen
help/all Display help for all targets
lint Lint terraform code
```

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| ami_owner | AWS Account ID which is used as a filter for AMI list (e.g. `123456789012`) | string | `` | no |
| backup_schedule | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | string | `cron(00 19 * * ? *)` | no |
| block_device_mappings | List of block device mappings to be included/excluded from created AMIs. With default value of [], AMIs will include all attached EBS volumes | list | `<list>` | no |
| cleanup_schedule | The scheduling expression. (e.g. cron(0 20 * * ? *) or rate(5 minutes) | string | `cron(05 19 * * ? *)` | no |
| instance_id | AWS Instance ID which is used for creating the AMI image (e.g. `id-123456789012`) | string | - | yes |
| name | Name (e.g. `bastion` or `db`) | string | `` | no |
| namespace | Namespace (e.g. `cp` or `cloudposse`) | string | `` | no |
| reboot | Reboot the machine as part of the snapshot process | string | `false` | no |
| region | AWS Region where module should operate (e.g. `us-east-1`) | string | `` | no |
| retention_days | Is the number of days you want to keep the backups for (e.g. `14`) | string | `14` | no |
| stage | Stage (e.g. `prod`, `dev`, `staging`) | string | `` | no |




## Related Projects

Check out these related projects.

- [terraform-aws-ec2-ami-snapshot](https://github.com/cloudposse/terraform-aws-ec2-ami-snapshot) - Terraform module to easily generate AMI snapshots to create replica instances
- [terraform-aws-efs-backup](https://github.com/cloudposse/terraform-aws-efs-backup) - Terraform module designed to easily backup EFS filesystems to S3 using DataPipeline




## References

For additional context, refer to some of these links.

- [Terraform config for automatic EBS snapshots](https://github.com/chef/lambda_ebs_snapshot) - This repo contains a terraform configuration that creates two lambda functions that will take automatic EBS snapshots at regular intervals.


## Help

**Got a question?**

File a GitHub [issue](https://github.com/cloudposse/terraform-aws-ec2-ami-backup/issues), send us an [email][email] or join our [Slack Community][slack].

## Commerical Support

Work directly with our team of DevOps experts via email, slack, and video conferencing.

We provide *commercial support* for all of our [Open Source][github] projects. As a *Dedicated Support* customer, you have access to our team of subject matter experts at a fraction of the cost of a fulltime engineer.

[![E-Mail](https://img.shields.io/badge/email-hello@cloudposse.com-blue.svg)](mailto:hello@cloudposse.com)

- **Questions.** We'll use a Shared Slack channel between your team and ours.
- **Troubleshooting.** We'll help you triage why things aren't working.
- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback.
- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects.
- **Build New Terraform Modules.** We'll develop original modules to provision infrastructure.
- **Cloud Architecture.** We'll assist with your cloud strategy and design.
- **Implementation.** We'll provide hands on support to implement our reference architectures.


## Community Forum

Get access to our [Open Source Community Forum][slack] on Slack. It's **FREE** to join for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build *sweet* infrastructure.

## Contributing

### Bug Reports & Feature Requests

Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-ec2-ami-backup/issues) to report any bugs or file feature requests.

### Developing

If you are interested in being a contributor and want to get involved in developing this project or [help out](https://github.com/orgs/cloudposse/projects/3) with our other projects, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com).

In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.

1. **Fork** the repo on GitHub
2. **Clone** the project to your own machine
3. **Commit** changes to your own branch
4. **Push** your work back up to your fork
5. Submit a **Pull Request** so that we can review your changes

**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request!



## Copyrights

Copyright © 2016-2018 [Chef Software, Inc](https://www.chef.io/)








## License

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Source: <https://opensource.org/licenses/MIT>






## Trademarks

All other trademarks referenced herein are the property of their respective owners.

## About

This project is maintained and funded by [Cloud Posse, LLC][website]. Like it? Please let us know at <hello@cloudposse.com>

[![Cloud Posse](https://cloudposse.com/logo-300x69.svg)](https://cloudposse.com)

We're a [DevOps Professional Services][hire] company based in Los Angeles, CA. We love [Open Source Software](https://github.com/cloudposse/)!

We offer paid support on all of our projects.

Check out [our other projects][github], [apply for a job][jobs], or [hire us][hire] to help with your cloud strategy and implementation.

[docs]: https://docs.cloudposse.com/
[website]: https://cloudposse.com/
[github]: https://github.com/cloudposse/
[jobs]: https://cloudposse.com/jobs/
[hire]: https://cloudposse.com/contact/
[slack]: https://slack.cloudposse.com/
[linkedin]: https://www.linkedin.com/company/cloudposse
[twitter]: https://twitter.com/cloudposse/
[email]: mailto:hello@cloudposse.com


### Contributors

| [![Sergey Vasilyev][s2504s_avatar]][s2504s_homepage]<br/>[Sergey Vasilyev][s2504s_homepage] | [![Mark Harrison][mivok_avatar]][mivok_homepage]<br/>[Mark Harrison][mivok_homepage] | [![Vladimir][SweetOps_avatar]][SweetOps_homepage]<br/>[Vladimir][SweetOps_homepage] | [![Tron Thongsringklee][thanandorn_avatar]][thanandorn_homepage]<br/>[Tron Thongsringklee][thanandorn_homepage] | [![Raymond Butcher][raymondbutcher_avatar]][raymondbutcher_homepage]<br/>[Raymond Butcher][raymondbutcher_homepage] | [![Anthony DeMartini][ademartini_avatar]][ademartini_homepage]<br/>[Anthony DeMartini][ademartini_homepage] | [![Konstantin B][comeanother_avatar]][comeanother_homepage]<br/>[Konstantin B][comeanother_homepage] | [![Seth Chisamore][schisamo_avatar]][schisamo_homepage]<br/>[Seth Chisamore][schisamo_homepage] |
|---|---|---|---|---|---|---|---|

[s2504s_homepage]: https://github.com/s2504s
[s2504s_avatar]: https://github.com/s2504s.png?size=150
[mivok_homepage]: https://github.com/mivok
[mivok_avatar]: https://github.com/mivok.png?size=150
[SweetOps_homepage]: https://github.com/SweetOps
[SweetOps_avatar]: https://github.com/SweetOps.png?size=150
[thanandorn_homepage]: https://github.com/thanandorn
[thanandorn_avatar]: https://github.com/thanandorn.png?size=150
[raymondbutcher_homepage]: https://github.com/raymondbutcher
[raymondbutcher_avatar]: https://github.com/raymondbutcher.png?size=150
[ademartini_homepage]: https://github.com/ademartini
[ademartini_avatar]: https://github.com/ademartini.png?size=150
[comeanother_homepage]: https://github.com/comeanother
[comeanother_avatar]: https://github.com/comeanother.png?size=150
[schisamo_homepage]: https://github.com/schisamo
[schisamo_avatar]: https://github.com/schisamo.png?size=150


Loading

0 comments on commit 968ea7e

Please sign in to comment.