|
1 | 1 | # Cleanup
|
2 | 2 |
|
3 |
| -### To prevent your account from accruing additional charges, you will want to remove any resources that are no longer needed. |
| 3 | +### *To prevent your account from accruing additional charges, you will want to remove any resources that are no longer needed.* |
4 | 4 |
|
5 |
| -#### Remove Cognito Resources and S3 Bucket Contents |
| 5 | +#### Empty S3 Bucket Contents and Remove Bucket |
6 | 6 |
|
7 |
| -1. First, we will need to empty the *S3 bucket* and remove resources such as your *Cognitio User Pools*. We can run a script from the **Cloud9 IDE** |
| 7 | +1. First, we will need to empty the ***S3 bucket*** that was created by our CloudFormation template. |
| 8 | +2. Go the AWS Management Console, click **Services** then select **CloudFormation** under Management Tools. |
| 9 | +3. In the **CloudFormation** console, click on your *Wild Rydes* stack name, such as `WildRydesAPI`. |
| 10 | +4. Click on the **Outputs** tab. |
| 11 | +5. Copy your bucket name to your clipboard. It is the name shown under Value for the key called `WildRydesProfilePicturesBucket`. |
| 12 | +6. Open the Cloud9 IDE |
| 13 | +7. Within the Cloud9 IDE, open up the terminal. You can do this by clicking the `+` icon in the lower pane and selecting **New Terminal**. |
| 14 | + |
| 15 | +  |
| 16 | + |
| 17 | +8. Paste the following command and be sure to update your S3 bucket name: |
| 18 | +``` |
| 19 | +$ aws s3 rb s3://MY-BUCKET-NAME --force |
| 20 | +``` |
| 21 | + |
| 22 | +#### Remove the Cognito Resources |
| 23 | +1. From your **Cloud9 IDE** run the following: |
| 24 | + |
| 25 | +> Be sure to paste your identity pool id from your scratch pad (ex. us-west-2:b4b755cd-d359-42a1-9b49-f0e73f5b2571) |
| 26 | + |
| 27 | +``` |
| 28 | +aws cognito-identity delete-identity-pool --identity-pool-id MY-IDENTITY-POOL-ID-HERE |
| 29 | +``` |
| 30 | +> If you lost your scratch pad with you idenity pool id, you can run a list call via CLI and find the proper identiy pool id, then run the abouve delete call. |
| 31 | +``` aws cognito-identity list-identity-pools --max-results 10``` |
| 32 | + |
| 33 | +2.Next, run the following to delete the User Pool you created: |
| 34 | + |
| 35 | +> Be sure to paste your user pool id from your scratch pad (ex. us-west-2:us-west-2_srLwFQiEC) |
8 | 36 |
|
9 | 37 | ```
|
10 |
| -cd Cleanup |
11 |
| -python cleanup.py |
| 38 | +aws cognito-idp delete-user-pool --user-pool-id MY-USER-POOL-ID-HERE |
12 | 39 | ```
|
| 40 | +> If you lost your scratch pad with your user pool id, you can run a list call via CLI and find the proper user pool id, then run the abouve delete call. |
| 41 | +```aws cognito-idp list-user-pools --max-results 10``` |
13 | 42 |
|
14 |
| -#### Remove API Stack |
| 43 | +#### Remove WildRydes Backend |
15 | 44 |
|
16 |
| -2. Next, we will need to remove the *CloudFormation stack* for the API. You called this the **WildRydesAPI**. From the CloudFormation console, select the **WildRydesAPI** stack radio button. From the actions menu, click Delete Stack. |
| 45 | +1. Next, we will need to remove the *CloudFormation stack* for the API. You called this the **WildRydesBackend**. Once again, from the terminal of the **Cloud9 IDE**, run: |
| 46 | + |
| 47 | +``` |
| 48 | +aws cloudformation delete-stack --stack-name WildRydesBackend |
| 49 | +``` |
| 50 | +> If you changed the name of your stack from the default, you will need to update the stack name to what you adjusted it to. If you clicked the quick link in the instructions, no adjustment to the command above is needed. You can run `aws cloudformation describe-stacks` to find your stack name. |
17 | 51 |
|
18 | 52 | #### Remove Cloud9 and VPC Stack
|
19 | 53 |
|
20 |
| -3. Lastly, we will need to remove the *CloudFormation Stacks*. Earlier, we had you deploy a CloudFormation template to create a VPC and A Cloud9 Instance. |
21 |
| -Select the **VPC Infrastructure Stack** radio button. From the Actions drop down, Choose Delete Stack. |
| 54 | +1. Lastly, we will need to remove the *CloudFormation Stack* for the **Cloud9 instance** and the VPC. You called this **WildRydes-Cloud9** |
| 55 | + |
| 56 | +``` |
| 57 | +aws cloudformation delete-stack --stack-name WildRydes-Cloud9 |
| 58 | +``` |
| 59 | +> If you changed the name of your stack from the default, you will need to update the stack name to what you adjusted it to. If you clicked the quick link in the instructions, no adjustment to the command above is needed. You can run `aws cloudformation describe-stacks` to find your stack name. |
0 commit comments