Running Cron on a specifc server in AWS - spring

I am developing a project in spring. In this project I have written a cron job as well. I am going to deploy this on 4 AWS servers, but I want my cron job to run on only a single server (let's name that as admin server).
So here my question is how can I identify admin server uniquely. I was thinking to use the IP as identification but as far as I know IP is not static for AWS servers. is there any other way for identification so that I can put that check in my cron job code so that it will run only on admin server?

You can always start the admin instance with some user data as metadata or add a tag to your instance.
The metadata solution might be easier to integrate as you can just issue an unauthenticated HTTP request from within the instance to read the value. If that is a security concern for you, then you can go with the tag and use the API to retrieve the tag value.

Related

NiFi - automating creation of users/groups during install

I have a puppet module that is deploying a standalone nifi instance. It's all working and it will deploy the application with an initial admin user etc via authorizers.conf.
But in order to configure additional users and groups there is a long process of creating policies and adding users and groups via the gui. I want to automate some of this in my puppet module.
It would be good to be able to automatically create an admin group which is already assigned to a load of policies.
It doesn't seem like this is possible though as the best-practice is to only edit authorizers.xml and allow that to create the resulting authorisations.xml and users.xml, and there is no setting within authorizers.xml to create initial groups or initial policies.
My only idea at the moment is to use something like the nipyapi python module to create users and groups via the api during the initial install.
Or perhaps ignoring the authorisers.xml and just deploy a pre-configured authorizations.xml and users.xml.
Am I missing any other simple or better options?

Nifi - Update Remote Process Group through Rest API

We are using templates to package up some data transfer jobs between two nifi clusters, one acting as a sender, the other as the receiver. One of our jobs contains a remote process group and all worked fine at the point the template was created.
However when we deploy the template through our environments (dev, test, pre, prod), it is tedious and annoying to have to manually delete and a recreate a remote process group in the user interface. I'd like to automate this to simplify deploying templates and reduce the manual intervention.
Is it possible to update a remote processor group and its port configuration through the rest-api ?
Do I just use the REST api to create a new RPG with the correct configuration ?
Does anyone have any experience with this?
There is a JIRA to address this issue [1] which will be worked in conjunction with some of the ongoing Flow Registry (SDLC for flows) efforts. Until then, the best option would be (2) above.
[1] https://issues.apache.org/jira/browse/NIFI-4526

Pros/Cons of Parse Dashboard local installation vs deployment

I wasn't able to find solid information on this and I wanted to ask developers who use Parse Dashboard:
What are the pros/cons of Parse Dashboard local installation vs deployment?
I currently run the Parse Dashboard on local installation, but I know that deployment to Heroku is also an option (my app is deployed on Heroku). I wanted to gather some information before deploying/not deploying.
Thank you!
I also have it running locally and I think for security reasons it's best to do so. If you setup the dashboard on the same server on which Parse is running, then you will have to take security measure to protect access to the dashboard and the config file which includes your masterkey and all that. This definitely outweighs the arguments to host it locally, which in my opinion only is that it's easier to access the dashboard.
If you really want to setup a dashboard on a server at least do it on a separate server.

Tagging EC2 machines in Pipeline's EMR Cluster (ImportCluster in the S3->DynamoDB example)

I'm trying to run the S3->DynamoDB example and having some problems running the EMR cluster that is created for the MyImportJob activity.
We configured our IAM accounts such that every user can create EC2 machines with a specific 'team_id' tag (of his team). That helps us control the resources, prevent mistakes and monitor usage.
When Pipeline tries to launch the EMR cluster, it (probably) does it without the tags and therefore it fails with Terminated with errors: User account is not authorized to call EC2. I tried to find a configuration in the EMRCluster resource but couldn't find anything that will help me set that. I'm pretty sure that it fails because of the tags policy.
Any idea how I can overcome this?
Does it help if If create a CloudFormation template for that? Do I have more control there? (I'm going to create the pipeline as a part of the application template anyway, just wanted to experience the product before).
Thanks!
I could not find a solution for how to add tags to EMR(and how to set it to be visible to all users) so I have created a python script to run as bootstrap action. If its still relevant you can find it here

Deploy Java Web application on Amazon Cloud

I have a web application developed with Struts2, JSP, JPA, Spring and MySql. I want to move this application to Amazon Cloud. I have not done a cloud deployment before or know how to do it.
Can anyone help me on a step by step process or a procedure to follow or a document that will guide me in doing this. Thanks for your help.
Upload your project's .war in elastic bean stalk and deploy project.
The steps to create a new application in beanstalk is -
1) Create a new application say "test app" in Elastic beanstalk, chose the region which best suits your requirement.
2) Create a new environment in the application "test app", select the application server you like to have i.e, tomcat 6 32/64 or tomcat732/64.
3) upload the .war in the newly created environment.
4) You can provide a custom Cname through which you can access you webapplication from browser.
5) Finally based on your requirements you can set the healthcheck status time interval, scaling unit
Got it... thanks for the detailed description.
You can make it in two ways
Create a singleBeanstalk application.
create different environments for each company within the created application, and in every environment deploy the .war file and provide the resources as per your requirement such as tomcat 6/7, minimum number of instances & maximum number of instances for Auto scaling. Health check monitor interval, no. of times to check before timeout etc.,. and finally assign the cname (i.e, the url by which you access the application) associated with the company name, like if the webapp is for xyz company then provide cname as xyz.elasticbeanstalk.com.
2 . Create multiple Beanstalk applications i.e., one for every company and in each application you can create multiple environments like Development, Beta, Staging and live - based on your requirement.
And coming to DB
Go for RDS if your DB is relational DB. Two ways to plan for multiple company's is
1) Create a single RDS and create multiple schema's in it i.e., one schema for one organization.
2) Create separate RDS for every organization - recommended if DB records are more
Let me know if you have any queries.
Happy to help...:)
please find me inline comments in bold.
Currently, the application is installed on a company's server, and users from the company that will use the application are created.
How is the installation done, and what is the architecture(x86/x64) and platform(windows
server/linux) of the server
The application knows how to manage its users. So every company that needs this application, buys a server and the application is deployed on the server.
Buys a server in the sense - you guys are providing the application and they are
launching in their server, i mean in their own infrastructure.
The facts i understood from your reply is, that you guys provide a web application to
different company's. And those company's deploy your webapplication in their
application server and DB in their DB server.
Correct me if am wrong

Resources