Menu
AWS CodeDeploy
User Guide (API Version 2014-10-06)

Step 6: Clean Up Your WordPress Application and Related Resources

You've now successfully made an update to the WordPress code and redeployed the site. To avoid ongoing charges for resources you created for this tutorial, you should delete:

  • Any AWS CloudFormation stacks (or terminate any Amazon EC2 instances, if you created them outside of AWS CloudFormation).

  • Any Amazon S3 buckets.

  • The WordPress_App application in AWS CodeDeploy.

You can use the AWS CLI, the AWS CloudFormation, Amazon S3, Amazon EC2, and AWS CodeDeploy consoles, or the AWS APIs to perform the cleanup.

To clean up resources (CLI)

  1. If you used our AWS CloudFormation template for this tutorial, call the delete-stack command against the stack named CodeDeployDemoStack. This will terminate all accompanying Amazon EC2 instances and delete all accompanying IAM roles the stack created:

    Copy
    aws cloudformation delete-stack --stack-name CodeDeployDemoStack
  2. To delete the Amazon S3 bucket, call the rm command with the --recursive switch against the bucket named codedeploydemobucket. This will delete the bucket and all objects in the bucket:

    Copy
    aws s3 rm s3://codedeploydemobucket --recursive
  3. To delete the WordPress_App application, call the delete-application command. This will also delete all associated deployment group records and deployment records for the application:

    Copy
    aws deploy delete-application --application-name WordPress_App

If you did not use the AWS CloudFormation stack for this tutorial, call the terminate-instances command to terminate any Amazon EC2 instances you manually created. Supply the ID of the Amazon EC2 instance to terminate:

Copy
aws ec2 terminate-instances --instance-ids instanceId

To clean up resources (console)

If you used our AWS CloudFormation template for this tutorial, delete the associated AWS CloudFormation stack.

  1. Sign in to the AWS Management Console and open the AWS CloudFormation console at https://console.aws.amazon.com/cloudformation/.

  2. In the Filter box, type the AWS CloudFormation stack name you created earlier (for example, CodeDeployDemoStack).

  3. Select the box beside stack name. In the Actions menu, choose Delete Stack.

    AWS CloudFormation deletes the stack, terminates all accompanying Amazon EC2 instances, and deletes all accompanying IAM roles.

To terminate Amazon EC2 instances you created outside of an AWS CloudFormation stack:

  1. Sign in to the AWS Management Console and open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the INSTANCES list, choose Instances.

  3. In the search box, type the name of the Amazon EC2 instance you want to terminate (for example, CodeDeployDemo), and then press Enter.

  4. Choose the Amazon EC2 instance name.

  5. In the Actions menu, point to Instance State, and then choose Terminate. When prompted, choose Yes, Terminate.

Repeat these steps for each instance.

To delete the Amazon S3 bucket:

  1. Sign in to the AWS Management Console and open the Amazon S3 console at https://console.aws.amazon.com/s3/.

  2. In the list of buckets, browse to and choose the name of the Amazon S3 bucket you created earlier (for example, codedeploydemobucket).

  3. Before you can delete a bucket, you must first delete its contents. Select all of the files in the bucket, such as WordPressApp.zip. In the Actions menu, choose Delete. When prompted to confirm the deletion, choose OK.

  4. After the bucket is empty, you can delete the bucket. In the list of buckets, choose the row of the bucket (but not the bucket name). Choose Delete bucket, and when prompted to confirm, choose OK.

To delete the WordPress_App application from AWS CodeDeploy:

  1. Sign in to the AWS Management Console and open the AWS CodeDeploy console at https://console.aws.amazon.com/codedeploy.

    Note

    Sign in with the same account or IAM user information you used in Getting Started.

  2. On the AWS CodeDeploy menu, choose Applications.

  3. In the list of applications, choose WordPress_App.

  4. On the Application details page, in Deployment groups, choose the button next to the deployment group. On the Actions menu, choose Delete. When prompted, type the name of the deployment group to confirm you want to delete it, and then choose Delete.

  5. At the bottom of the Application details page, choose Delete application.

  6. When prompted, type the name of the application to confirm you want to delete it, and then choose Delete.

What's Next?

If you've arrived here, congratulations! You have successfully completed an AWS CodeDeploy deployment, and then updated your site's code and redeployed it.