I have a static website currently hosted on AWS and I suppose its static (i.e. I can't update it without manually changing the HTML and then reuploading to AWS). I want to make it easier for myself to update certain sections (particularly the 'dates' section). So I was thinking of using a JSON object. Ideally the AWS website would be able to update from a JSON file on my local/personal computer but I'm not sure if that's possible? Do I need the JSON file to be uploaded to a web server/AWS every time I change it? I would like to just update my JSON file locally and not have to change/update anything in AWS. Is this possible or do I need some type of API?
From what I get from your question, I can think of the below two use-cases:
1) In case your static website is hosted on S3, you can use the AWS CLI (Command Line Interface): https://aws.amazon.com/cli/. This will allow you to upload the files directly from your local machine to the S3 bucket.
2) In case it is hosted on an EC2 Instance, you can setup a git repository for your website and push the changes made to the git server. The same git server can then be used to pull the latest changes on your EC2 instance.
Related
As my title states, we are using the AWS .NET SDK and on our web.config configured a profile that points to a credentials file(see: https://docs.aws.amazon.com/sdk-for-net/v2/developer-guide/net-dg-config-creds.html using credentials file) on the disk(so out of the source code). This seems to work fine but we are rotating these keys every x period so we need to change the keys within the file. My question is does de AWS .NET SDK notice that the file is changed and automatically load the new credentials or when does it actually load? In other words, if we change the credentials in this file do we need to do additional steps for the application to actually use them?
What I tried now is start up the application locally, change the credentials to a faulty one and calls are still going thru without a problem. Next, I stopped my application and rebuilded in with the same file having faulty credentials. After doing this the application is still able to make correct calls so I'm wondering how this works as if it is falling back on credentials that did work. Or maybe I just didn't test right.
We are using .net framework 4.6.2 application using the aws sdk version 3.3
Also what i forgot to mention is that for each request we initialize the client like this:
using (AmazonCognitoIdentityProviderClient client = new AmazonCognitoIdentityProviderClient(regionEndpoint))
Short answer is creating a client like that will cause the credentials to be read from the credentials file when the first client is created.
The longer answer is when you create without credentials the client uses the FallbackCredentialsFactory class to find credentials either through the credentials file or environment like EC2 instance metadata. The FallbackCredentialsFactory has a static instance of Amazon.Runtime.CredentialManagement.CredentialProfileStoreChain which is what gets the credentials for a profile.
If you want to something different you could have your code create an instance of CredentialProfileStoreChain before creating a client and use that to get the credentials and pass those credentials into the client.
I have a PHP application I am wanting to deploy to Azure via Github. One of the files is a connection to a MySQL DB, which for obvious reasons, I don't want to have tracked on Github. The issue I am running into is getting connected to the DB, and displaying my webpage properly, because the connect.php file isn't in Github. What is the best way to get that to Azure without going through Github?
In your connect.php file, get your values from an environment variable instead of setting it explicitly. Then, in your Azure portal, go to the web app's Application Settings blade & set your environment variables under the App settings section.
I am new to cloud foundry. I am currently working on a requirement where I have to upload a CSV file (via JSP UI) into a service deployed in cloud foundry and persists its data in service.
The issue is from UI, I only get a local path of that CSV file and when I am trying to parse that CSV via this path the file is not recognized. I guess the reason is service is already deployed in CF, so it does not recognize this local machine path.
Can you please let me know how can I parse this CSV file in local machine and where to parse this CSV.
Thanks in Advance!
There is nothing specific to Cloud Foundry about how you would receive an uploaded file in a web application. Since you mentioned using Java, I would suggest checking out this post.
How to upload files to server using JSP/Servlet?
The only thing you need to keep in mind that's specific to Cloud Foundry is that the filesystem in Cloud Foundry is ephemeral. It behaves like a normal filesystem and you can write files to it, however, the lifetime of the filesystem is equal to the lifetime of your application instance. That means restarts, restages or anything else that would cause the application container to be recreated will destroy the file system.
In short, you can use the file system for caching or temporary files but anything that you want to retain should be stored elsewhere.
https://docs.cloudfoundry.org/devguide/deploy-apps/prepare-to-deploy.html#filesystem
Is it possible to push data to a local json file stored in my app folder using the $http service?
I've tried fiddling around with $http.post/.get and can't find a way to save/push new data into my local .json file.
Javascript is a client side program and therefore has no ability to modify files on your server (if you're just playing with directories on your local machine, for all intents and purposes, the local machine is your server.) Its only concern is client side logic. You need some type of server backend to do this.
I am trying to have my app on Amazon appstore.
In order to do this Amazon needs to park a small json file (web-app-manifest.json).
If I upload it to the the root of my web site (as suggested), Amazon bot says it cannot access file. Amazon support mention I should save it to /var/www/static but either I don't know how to get there or I don't have access to this part of the server.
Any ideas ?
You can get to /var/www/static in the File browser. Just click on the '/' in the path at the top of the page and then follow the links.
You can also just copy things there from a Bash console.
You may need to create the static folder in /var/www if it's not there already.
Ok...After some clarifications from PythonAnywhere and Amazon support, this what worked for me:
Assume:
The name of website is XYZ.
One accesses the web site at: https://XYZ.pythonanywhere.com/XYZ/default/index
Amazon json file is parked at https://XYZ.pythonanywhere.com/web-app-manifest.json
Which on the file system at PythonAnywhere translates to:
/var/www/static/web-app-manifest.json
Amazon support asked me to add to this json file the following snippet:
"launch_path":"XYZ/default/index",
Now Amazon bot can access the manifest file and authenticate my relationship with it for the Amazon appstore.