Update custom synonyms package version on AWS Elasticsearch domain - amazon-web-services

We're using AWS's elasticsearch service. We have a custom synonyms package associated with the elasticsearch domain. The file lives in an s3 bucket, when the file is updated it triggers a lambda that updates the package version in AWS. We followed the documentation at https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/custom-packages.html and so far that all works great for uploading and updating a new version of the package. However, the way aws elasticsearch custom packages work, each domain that uses the custom package stores its own copy of the file as well. To keep search behavior predictable, domains continue to use their current package version until you explicitly update them.
The problem is that I can't find any way to programmatically tell the domain to use the new version of the package. It's like 2 clicks in the console, but I cannot for the life of me find a way to do it from my automation code. The update_package method just updates the package version, it doesn't tell the associated domains to use the new version.
We're looking for a way to programatically tell an AWL elasticsearch domain to update the version of an associated custom synonyms file.

So after banging my head on this for days and I finally figured it out 5 minutes after posting this question. You just need to call the associate_package method again after you update the package. I had actually tried that previously and it failed, but it turns out it fails if there is no new version of the package available. I think I was calling associate_package again before the update_package method was completed, so the new version wasn't available yet.
Anyway, hope this helps someone in the future.

Correct, you have to specifically call associate_package to link to the latest version of that package

Related

Missing Jenkins Job Information

Recently I restarted my AWS instance and got a new IP address but after I restarted both Jenkins and AWS, the information about my previous jobs was no longer shown in Jenkins.
I checked the path and it still exists in the instance but it is not shown on the web. I tried to create another project and it still created in the same path just that only the newly created project is in. Any suggestions on how to recover my missing projects??
FYI
I have lots of old plugins that mentions "xxx failed to load" so I do not know if that is causing it.
one of my plugins does not match and all those that depends on it will fail to show on the installed section of the plugin. Thus I remove all the plugins by deleting it directly from the plugin folder and check for the working copy that was on my previous version and download the same version of plugins. After which, all the jobs come back on screen

How to download and edit lambda with AWS explorer

I'm trying to use AWS explorer in PyCharm to download and edit an existing lambda function on my AWS account, but I'm unable to find out how to do that. I've read through all the documentation available on the wiki as well as followed a bunch of tutorials on deploying new lambda functions, but I can't find out how to edit and download existing functions. I can download the AWS lambda using the console, but I'm not sure how to get this to be editable in my PyCharm project, but this also seems like a workaround anyway. Is there a way to do this within the AWS Explorer tool?
No, currently (Oct 2019) you can't download a Lambda Function's source and edit it locally. If you know the name of the S3 object where the code is stored, you could pull that file down adn make changes, re-zip it, re-upload it back to S3, force the Lambda to cold-start (change the memory slider) and it will pick up the new code. but this is extremely brittle.
Have you tried cloud9, I find it the best way to work on lambdas, especially if you are working as a team. but the problem with cloud9 is also it seems it's not actively being developed and you have lots of manual work to update SAM and dev tools in there. Anyhow I still recommend cloud9.

AWS Serverless Image Handler - Lambda Error

My Serverless image handler was working fine till now and now i'm getting the following error.
start_thumbor error: pycurl: libcurl link-time ssl backend (openssl) is different from compile-time ssl backend (nss)
This looks like a problem with the version of pycurl.
Please help me resolve it.
Tried changing the pythong version to 3.6 in ServerlessImageHandler lambda function configuration.
I found a discussion about that issue on https://forums.aws.amazon.com/thread.jspa?messageID=909444, which sent me to https://github.com/awslabs/serverless-image-handler/issues/127#issuecomment-514757029.
Github user timkelty has the solution:
go to my CloudFormation Stack
click Update
"replace template"
paste in https://cf-templates-nestrom.s3-eu-west-1.amazonaws.com/serverless-image-handler/1.0/serverless-image-handler.template
so far has worked for me in us-east-1 and us-west-1
AWS has released a new version of Serverless Image Handler this is why everybody suffers now because Thumbor functionalities fail in the new version.
In the new version, SharpJS is used instead of Thumbor API calls.
You can check the new version and download it from here.
Even though you are able to construct urls in old style, images in subfolders are not possible to access anymore without encoding the url.
Old way:
abcdef.cloudfront.net/team/team1.png
New way:
abcdef.cloudfront.net/{base64encodedPath}
Note 1: If your images are in the root directory of the bucket, you are still able to access them old style like this:
abcdef.cloudfront.net/team1.png
Note 2: If you update your existing CloudFormation stack, you will have your old cloudfront domain (which is a good part).
You can also follow the current fixes from here.

Dynamically append function to AppSync Pipeline Resolver via CloudFormation

I am currently developing an AppSync based API in a domain driven manner, so we need to put a function to an already created Pipeline Resolver. Does anybody know if there is there any chance doing this via CloudFormation without using a custom resource?
Thanks in advance, Sven
Terraform can do this neatly if you can build this pull request yourself or vote in this issue to get it merged into a public release.
The new syntax is described here.
The build process is actually quite simple. It took me about 30 min end-to-end.
Install GoLang.
Clone the repo with the changes and sync it with the main (upstream) repo.
Make sure you cloned it into go\src\github.com\terraform-providers\terraform-provider-aws folder.
Run go build from go\src\github.com\terraform-providers\terraform-provider-aws
Replace .terraform\plugins\...\terraform-provider-aws-* executable with the one you compiled.
Run terraform init
Test by trying to import a function terraform import aws_appsync_function.example xxxxx-yyyyy
I hope the pull request gets merged by the time you read this.

How do I know when a service was added to boto3?

I have a tool which requires boto3's direct connect functionality. However I cannot tell from which version onwards boto3 includes this functionality.
Is there any way to obtain the older version of the docs to see at which point direct connects were added?
At this point in time the latest is 1.4.4.
boto3 development is an open source initiative. So you can always checkout botocre development repository for the release notes, or ask question there.
changelog.rst will show a brief list of changes.
Then use following command to switch to specify tag version and look for the date of commit.
git checkout tags/<version_name>