Skip to content

Commit

Permalink
cange to doc and requiremetns
Browse files Browse the repository at this point in the history
  • Loading branch information
jbcodeforce committed Jan 18, 2024
1 parent ba659a5 commit 5df66da
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
7 changes: 4 additions & 3 deletions aws/produceToSQS.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import boto3
import boto3,os

account_id=os.getenv("AWS_ACCOUNT_ID")
sqs = boto3.resource('sqs')
queue = sqs.get_queue_by_name(QueueName='test')
queue = sqs.get_queue_by_name(QueueName='MyQueue',QueueOwnerAWSAccountId=account_id)
print("Send a txt messsage")
response = queue.send_message(MessageBody='world')
response = queue.send_message(MessageBody='Hello from client app')
print(response.get('MessageId'))
print(response.get('MD5OfMessageBody'))
6 changes: 4 additions & 2 deletions docs/aws/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ s3 = goto3.service("s3")
s3.buckets.all()
```

### Access DynamoDB
### [Access DynamoDB](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html)

The client have can get the table name using the API client:
The client can get the table name using the API client:

```python
import os, boto3
Expand Down Expand Up @@ -76,6 +76,8 @@ orderTable.put_item(
```

* Run it once the python virtual env is enabled with `python dynamoClient.py`
* **scan** to run all items from a table. It performs eventually consistent reads
* [**put_item**](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb/client/put_item.html): If an item that has the same primary key as the new item already exists in the specified table, the new item completely replaces the existing item

### [CDK with python](https://jbcodeforce.github.io/aws-studies/coding/cdk/)

Expand Down
5 changes: 5 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ See [detailed note here](astronomy/README.md) and code is under `astronomy` fold

To get some sample code to use AWS SDK [see this folder](https://github.com/jbcodeforce/python-code/blob/master/aws).

## Unit testing

* [Pytest framework](https://docs.pytest.org/en/7.3.x/#)
* [moto for backend mockup]http://docs.getmoto.org/en/latest/index.html)

## Some tricks

* placing cursor to previous line and enter will copy the line to a new line
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mkdocs-material
mkdocs-minify-plugin
#mkdocs-jupyter
#matplotlib
#nbconvert==5.6.1
7 changes: 2 additions & 5 deletions startPythonDocker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ then
name=$1
port=$2
fi
if [[ -z "$IPADDR" ]]
then
export IPADDR=$(ifconfig en0 |grep "inet " | awk '{ print $2}')
fi

docker run --rm -e DISPLAY=$IPADDR:0 -v /tmp/.X11-unix:/tmp/.X11-unix --name $name -v $(pwd):/app -it -p $port:$port jbcodeforce/python bash

docker run --rm -e DISPLAY=host.docker.internal:0 -v /tmp/.X11-unix:/tmp/.X11-unix --name $name -v $(pwd):/app -it -p $port:$port jbcodeforce/python bash

0 comments on commit 5df66da

Please sign in to comment.