Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
victoria-mckinney committed Oct 18, 2024
0 parents commit 03d24f4
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
128 changes: 128 additions & 0 deletions code.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### **AWS SDK (for Python)**\n",
"source: [aws website](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html)\n",
"date: Friday 18 September 2024"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### **Using Boto3**\n",
"To use Boto3, you must first import it and indicate which service or services youʼre going to use: "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import boto3\n",
"\n",
"# Let's use Amazon S3\n",
"s3 = boto3.resource('s3')\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"am-results-bucket\n",
"aws-athena-query-results-588077357019-eu-west-2\n",
"aws-athena-query-results-588077357019-us-east-1\n",
"aws-athena-query-results-588077357019-us-east-2\n",
"aws-sam-cli-managed-default-samclisourcebucket-c8egujefvafp\n",
"aws-sam-cli-managed-default-samclisourcebucket-zoyhx0uolbkv\n",
"bedrock-data-sources\n",
"bedrock-kb-cddo1\n",
"c-af-etl\n",
"c-af-get-approval-spend-service\n",
"c-af-job-mapping-tool-bucket\n",
"cddo-digital-dashboard-production-data\n",
"cddo-digital-dashboard-production-dev\n",
"cddo-digital-dashboard-production-etl-jobs\n",
"cddo-digital-dashboard-production-tfstate\n",
"cddo-digital-dashboard-production-transformed-data\n",
"cddo-llm\n",
"cddo-static-websites\n",
"cddo-static-websites-cloudfront-logs\n",
"cddo-worforce-commission-data\n",
"cdk-hnb659fds-assets-588077357019-eu-west-2\n",
"elasticbeanstalk-eu-west-2-588077357019\n",
"intranet-scrape\n",
"rapid-cddo\n",
"rapid-cddo-access-logs\n",
"rapid-cddo-aws-athena-query-results-588077357019\n",
"rapid-cddo-logs\n",
"rapid-cddo-static-ui-yvbcnusv\n",
"sagemaker-eu-west-1-588077357019\n",
"sagemaker-studio-588077357019-2bsh5xfeg29\n",
"sagemaker-studio-grykzxcl5w9\n",
"serverless-pdf-chat-eu-west-2-588077357019\n",
"sr-business-cases\n"
]
},
{
"ename": "FileNotFoundError",
"evalue": "[Errno 2] No such file or directory: 'test.jpg'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[8], line 6\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28mprint\u001b[39m(bucket\u001b[38;5;241m.\u001b[39mname)\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m# Upload a new file\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28;43mopen\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mtest.jpg\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mrb\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m data:\n\u001b[1;32m 7\u001b[0m s3\u001b[38;5;241m.\u001b[39mBucket(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mc-af-job-mapping-tool-bucket\u001b[39m\u001b[38;5;124m'\u001b[39m)\n",
"File \u001b[0;32m~/Library/visual_studio_projects/aws_sdk_python/.venv/lib/python3.12/site-packages/IPython/core/interactiveshell.py:324\u001b[0m, in \u001b[0;36m_modified_open\u001b[0;34m(file, *args, **kwargs)\u001b[0m\n\u001b[1;32m 317\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m file \u001b[38;5;129;01min\u001b[39;00m {\u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m1\u001b[39m, \u001b[38;5;241m2\u001b[39m}:\n\u001b[1;32m 318\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 319\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIPython won\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mt let you open fd=\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mfile\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m by default \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 320\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mas it is likely to crash IPython. If you know what you are doing, \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 321\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124myou can use builtins\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m open.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 322\u001b[0m )\n\u001b[0;32m--> 324\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mio_open\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfile\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'test.jpg'"
]
}
],
"source": [
"# Print out bucket names\n",
"for bucket in s3.buckets.all():\n",
" print(bucket.name)\n",
"\n",
"# Upload a new file\n",
"with open('test.jpg', 'rb') as data:\n",
" s3.Bucket('c-af-job-mapping-tool-bucket')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Binary file not shown.
17 changes: 17 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

### AWS SDK (for Python)

**[SOURCE](https://aws.amazon.com/sdk-for-python/)** (see also child folder for documentation)


**Date:** Friday 17 October 2024

---
#### Requirements

- Python==3.12.6
- [boto3](https://pypi.org/project/boto3/)
- [ipykernel](https://pypi.org/project/ipykernel/)



2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
boto3
ipykernal
1 change: 1 addition & 0 deletions test.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 03d24f4

Please sign in to comment.