Posts

Showing posts with the label aws

Why can't I build AWS OpenSearch/ElasticSearch index, which I could do that before?

One of the reason when you used to build AWS OS/ES index, and you can't do that now, is that there is a maximum shard default setting in AWS, which is 1000 shards. If you continuously build index, yet you did not remove old indices, there will be an increasing number of shards that occupied OS/ES. Until when a new index is built, and new shard is created that exceed the number of maximum shard, you got an error. Solution: Remove old/existing OS/ES indices. While it works for AWS, if you are using on-premise, it should be applied as well. Hope it helps someone.

How to use aws-lambda-python docker image with example in VSCode for local development

Image
Docker image: https://hub.docker.com/r/amazon/aws-lambda-python This docker image lacks working example on how to use. If you just want to test your lambda with this image locally, please read on. Let's assume the following: Your script is called `my_python.py` The function in this file that you want to execute is called `lambda_handler` Here is the docker command (I'm using windows): docker run --rm \ -p 9000:8080 \ --mount type=bind,src=/c/projects/my_lovely_proj,target=/var/task \ amazon/aws-lambda-python \ my_python.lambda_handler Brief explanation on above: --rm : Remove the container after terminating the script (i.e. Ctrl + C in command line).  So you don't need to run `docker stop <container_id>` and `docker rm <container_id>` -p 9000:8080: map the port of local machine 9000 to container port 8080.  This is super important and will be explained later. --mount: Mount the dir to /var/task in container.  All lambda script will be executed in this /var/tas...

[Solved]AWS ECR keep waiting: --profile is created using aws configure --profile

Reference:  https://stackoverflow.com/a/70453287/1802483 Problem:  You are trying to push a docker image to ECR While you use the command provided by AWS and show "Login successfully" when running this command: `aws ecr get-login-password --region <your_region> | docker login --username AWS --password-stdin <aws-account-id>.dkr.ecr.<your-region>.amazonaws.com`, you still saw "Waiting" or "Preparing" when you run `docker push` Possible reason and solution: Chances are you are using multiple AWS accounts You need to "login" to correct AWS ECR account when you run `aws ecr get-login-password` If you read the link above, you would see a parameter called `--profile` `--profile` is actually created using `aws configure --profile <your_profile_name>` i.e. To push to your ECR using correct account, you need to create a new profile by running `aws configure --profile <your_new_profile_name>` To create a new profile, you need ...