Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPO-143: Adds manual for restoring DynamoDB tables #10

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# OTT Developer Docs

👉 https://docs.trade-tariff.service.gov.uk/ - production
👉 https://docs.staging.trade-tariff.service.gov.uk/ - staging
👉 https://docs.dev.trade-tariff.service.gov.uk/ - development
You can find the developer docs deployed, here:

- [production]
- [staging]
- [development]

This is a static site generated with Middleman, using [alphagov/tech-docs-template](https://github.com/alphagov/tech-docs-template).

Expand Down Expand Up @@ -79,6 +81,7 @@ This will create a `build` directory containing a set of HTML files.

[MIT License](LICENCE)

[development]: /.github/workflows/development.yml
[staging]: /.github/workflows/staging.yml
[production]: /.github/workflows/production.yml

[development]: https://docs.dev.trade-tariff.service.gov.uk/
[staging]: https://docs.staging.trade-tariff.service.gov.uk/
[production]: https://docs.trade-tariff.service.gov.uk/
Binary file removed favicon.ico
Binary file not shown.
Binary file added source/images/aws/dyanmodb-pitr-restoring.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
owner_slack: "#trade-tariff-infrastructure"
title: Restore tables in AWS DynamoDB using PITR
section: Backups
layout: manual_layout
parent: "/manual.html"
---

This playbook describes how to restore a table using Amazon's [DynamoDB PITR][dynamodb-pitr].

We use DynamoDB Point in Time Recovery (PITR) backups to keep 35 days worth of
changes to a configured dynamodb table.

> Most dynamodb tables - for instance those used for terraform locks, do not include
> this functionality.

## Prerequisites

1. AWS account configured with the correct permissions
2. Any browser

## Restore a DynamoDB table via the AWS Console

The procedure for restoring a DynamoDB table using PITR is as follows:

1. Navigate to DynamoDB > Tables > your table
2. Select the Backups tab
3. Click Restore
4. Choose a name for your table (for example `CustomerApiKeys-restored`)
5. Pick either the latest snapshot or specify a date and time where the data was last in a good state
6. Decide whether you need secondary indexes restored (pick `Restore the entire table`). This is more expensive but may be necessary if you have a lot of indexed data that is crucial for your application's performance
7. Choose `Same Region` for the region
8. Choose `Owned by Amazon DynamoDB` for the encryption keys
9. Select Restore at the bottom of the form

Once the newly-restored table is available, you will need to configure your application to use it.

> We recommend using environment variables to easily update your table names in your ECS application/lambda

![Screenshot of the DynamoDB PITR form](images/aws/dynamodb-pitr-restoring-form.png)
![Screenshot of the DynamoDB table restoring](images/aws/dyanmodb-pitr-restoring.png)

[dynamodb-pitr]: https://github.com/trade-tariff/trade-tariff-lambdas-database-backups
2 changes: 1 addition & 1 deletion source/manual/how-to-backup-and-restore-in-aws-rds.html.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
owner_slack: "#trade-tariff-infrastructure"
title: Backup and restore databases in AWS RDS
title: Restore databases in AWS RDS
section: Backups
layout: manual_layout
parent: "/manual.html"
Expand Down
Loading