.. _Cleanup: Cleanup after tutorials ======================= Most of the elements in the tutorials were created following Infrastructure as Code technique. Thus temoving AWS CloudFormation stacks will recursively remove all the resources that were created from them. .. code-block:: bash # Get your AccountId from EC2 metadata. Assuming you run this on EC2. ACCOUNT=`curl http://169.254.169.254/latest/meta-data/identity-credentials/ec2/info/ | \ grep AccountId | awk -F "\"" '{print $4}'` # You can't remove non-empty S3 bucket, so first clean it. BUCKETNAME=sosw-s3-$ACCOUNT aws s3 rm s3://$BUCKETNAME --recursive # Remove CloudFormation stacks cd /var/app/sosw python3 examples/cleanup.py .. note:: In some cases you might need to run the script ``python3 examples/cleanup.py`` several times until all stacks are removed. This is because of ``ImportValue`` dependencies. After you run this it is highly recommended to check manually that the resources were indeed removed: - CloudFormation stacks - S3 Bucket - Lambda Functions - IAM Roles - DynamoDB Tables - CloudWatch Events Scheduled Rules Last thing - terminate your EC2 instance if you were running the tutorial from it. .. warning:: Please be aware of different regions (selector in upper right corner of web-console). Most of the scripts were region-inspecific and resources were created in same region where your were running them from. But for this tutorial we recommended using `us-west-2` (Oregon) region and some scripts might have this region hardcoded.