Including aws-java-sdk jar in Production - amazon-web-services

The only feature of AWS that we are going to use is s3. I have the aws-java-sdk-<ver>.jar which is ~14MB jar. Is there a standalone jar available for just using s3 (I mean the core components and s3 features)?
I looked up on the web, tried combination of names (appended s3 to links etc.) but couldn't find any. However, I stumbled upon this page : JARs for Android. There are feature specific jars for aws on Andorid. I have a feeling that they would have something similar for the regular java sdk as well. Has someone come across that or my only resort is to include the 14 MB jar?
Thanks.

This has been addressed with the AWS SDK for Java 1.9.0 release in the meantime:
Starting from 1.9.0 version, the SDK Maven project got split into multiple Maven modules. It allows you to pick up only a small subset of the SDK according to which AWS services you need to work with.
The split is basically 'one module per service', allowing to import only a core module aws-java-sdk-core, along with the one (or more) service specific module(s) actually needed, e.g. aws-java-sdk-s3.

Related

How often do Cloud Build Node.js versions update?

I couldn't stomach purchasing the $150 for GCP's support service for this one question. I'm just looking to understand the schedule for Cloud Build Node.js versions. It's still stuck on Node.js v10.10 and my projects are starting to require higher versions to build. According to Cloud Build's changelog, I don't believe the Node.js version has updated in years. Any ideas?
As per the official Github repository:
Our client libraries follow the Node.js release schedule. Libraries are compatible with all current active and maintenance versions of Node.js.
So, this means it should work with Node.js 12 and the updates should be more constant. In addition to that, in here, it says that if you are using a Cloud Build config file, you can use Node.js 12, so the Node.js' latest version should be compatible with Cloud Build.
To summarize, by the repository, it should follow Node.js schedule. However, in case you think this is not occurring, I would recommend you to raise a bug on the Google's Issue Tracker - it's free, by the way - so they can assess this.

How can I publish serverless application on AWS faster?

I do not know how this question is logic but if there is anyway to solve this issue, it will cause to not waste my time.
I have a ASP.net core application that consist of many libraries like jquery, modernizer and etc. All of them stored in lib folder in wwwroot folder.
When I start publishing on AWS (with AWS Toolkit) it start zipping and publishing on the server as usual.
The point is that it will take a lot of time for zipping all of the libraries. these library does not any change during the project and I just change some pages or classes.
Is there any way to cancel zipping some folders to publish faster?
You can add this in your AWS serverless template to remove unwanted packages from the bundle.
package:
exclude:
- scripts/**
- dynamodb/tables/**
- policies/**
- dynamodb/seeds/**
If you are using a CI/CD methodology then you can ask the code builder to use a script in a root folder structure to run your package resolvers and all. Please refer this documentation

Using Serverless framework on monorepo of multiple services with shared code

I have a pythonic serverless project on AWS, in which several services are contained in a single repository (a monorepo) which looks like:
/
serverless.yml
/service1
lambda_handler.py
/service2
lambda_handler.py
/general
__init__.py
utils.py
'general' is a package that is shared between different services, and therefore we must use a single 'serverless.yml' file at root directory (otherwise it won't be deployed).
We have two difficulties:
A single 'serverless.yml' may be too messy and hard to maintain, and it prevents us from using global configuration (which may be quite useful).
Deplyoing a single service is complicated. I guess that 'package' feature may help but I'm not quite sure how to use it right.
Any advise or best practices to use for this case?
Its better to use individual serverless.yml files per each service. To use the shared code,
You can convert the code into a library and use it as a dependency and installed via a package manager for each individual service similar to a library. (This is useful since updating a version of common code won't affect the other services)
Keep the shared code in a different repository and use git submodule for individual service.
For more information, refer the article Can we share code between microservices which I have originally written considering serverless.

where to find specific version of aws-java-sdk?

I want to download aws-java-sdk-1.9.5, could not find any archive for this jar.
Whatever I am finding is the latest jar from AWS site https://aws.amazon.com/sdk-for-java/
I also checked maven repository but there the available jar is of 2 KBs only that didn't contain any source in the jar.
http://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk/1.9.5
Any suggestion would be appreciated.
You can download from official AWS Repo.
Here is the link for version 1.9.5
The aws-sdk-java JAR contains a list of dependencies on all other JARs in the AWS SDK. If you depend on it, then by Maven's transitive dependency mechanism you will add all of the other SDK JARs to your dependency tree.
Which you do not want to do
I've lost count of the number of individual AWS JARs, but there are a lot -- certainly dozens, possibly as many as a hundred. There's one JAR (at least) per AWS service, most of which you will never use.
A better approach is to download that JAR so that you know the names of the dependencies, then import them individually.

Make fat jar from the project with fat jar itself, using sbt assembly

I am using sbt-assembly to make my scala project into a fat jar.
This project is using play-json, and AWS SDK.
In the meantime, it is also using DynamoDB Transaction Lib as a fat jar, which is using Jackson and AWS SDK of another version.
When I used sbt assembly to make jar, error came out because of same path of libs between jackson, joda-date and other dependence shared by the AWS SDKs that I used and the ones used by DynamoDB Transaction Lib.
Due to DynamoDB Transaction Lib its own issue, I must use these two versions of both jackson and AWS SDK.
Is there any way to solve it by using merge strategy?
THX in advance!
A fat jar is for deployment only. Using it as a library is a really bad idea.
Due to DynamoDB Transaction Lib its own issue, I must use these two versions of both jackson and AWS SDK.
Are you saying you need to use two different versions of jackson simultaneously? I don't think sbt-assembly can help you with that. Merge strategy can pick one of them.