\n",
- "\n",
- "Run this notebook after you completed Data Wrangler time series lab. If you do this workshop in your own account, you must clean up used resources to avoid charges.\n",
- "\n",
- "Before closing this workshop you have to stop Data Wrangler instance, stop Studio kernel and remove S3 bucket to prevent unexpected charges. "
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Stop Data Wrangler and Studio compute instance\n",
- "To stop DataWrangler and Studio kernels:\n",
- "1. Click on \"Running termanals and kernerls\" button on a left plane \\\n",
- "![kernelButton](./pictures/kernelButton.png)\n",
- "1. Click on \"Shut down\" buttons next to running instances. \n",
- "![runningInstances](./pictures/runningInstances.png)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Remove workshop S3 bucket\n",
- "Now it is a time to remove S3 bucket we created for the workshop and all files in it. \n",
- "\n",
- "
💡This is a destructive operation. All data in the S3 bucket will be deleted!
"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 15,
- "metadata": {},
- "outputs": [],
- "source": [
- "%store -r bucket_name\n",
- "\n",
- "try:\n",
- " bucket_name\n",
- "except NameError:\n",
- " print(f'there is no S3 bucket name stored. ')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 16,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "The all content and the bucket s3://906545278380-us-east-1-datawranglertimeseries-1284 will be deleted. Are you sure (y/n)?\n"
- ]
- },
- {
- "name": "stdin",
- "output_type": "stream",
- "text": [
- " n\n"
- ]
- }
- ],
- "source": [
- "import boto3\n",
- "\n",
- "# Last step is to remove data in S3 bucket. \n",
- "print(f'The all content and the bucket s3://{bucket_name} will be deleted. Are you sure (y/n)?')\n",
- "\n",
- "choice = input()\n",
- "if choice == 'y':\n",
- " print(f'deleting the bucket s3://{bucket_name}')\n",
- " s3 = boto3.resource('s3')\n",
- " bucket = s3.Bucket(bucket_name)\n",
- " bucket.objects.all().delete()"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "## Shut down the notebook kernel"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 17,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "\n",
- "
Shutting down your kernel for this notebook to release resources.