Steven Yong
Steven Yong

Reputation: 5446

AWS::CloudFormation::Init: Updating files after Install

I am setting up my solr instance on a AWS EC2 instance:

EC2_Instance(:SolrInstance) {
 KeyName key_name
 ...

 'AWS::CloudFormation::Init' => {
   "configSets": {
     "InstallAndRun": [ "Install", "Configure" ]
   },
  "Install": {
    sources: {
     "/opt/solr-6.2.1/server/solr/lib": solr_jar,
     "/opt/solr-6.2.1/server/solr/configsets/data_driven_schema_configs/conf": solr_confs,
     "/opt/solr-6.2.1/server/resources": log4jproperties
   },
 },
 "Configure": {
   commands: {
     "010_start_app": {
      "command": "/opt/solr-6.2.1/bin/solr start -c && sleep 40"
     }
   }
  })
 UserData FnBase64(FnFormat(File.read('cfn_scripts/install_solr.sh')))
 }

solr_confs and solr_confs are some zip files on S3.

Then in the install_solr.sh, I have the following:

#!/bin/bash -x

set -e

/opt/aws/bin/cfn-init -v --stack %{AWS::StackName} --resource SolrInstance --configsets InstallAndRun --region %{AWS::Region}

It works well for 1st deployment.

Now I need to update a file in one of the file in solr_confs.

I updated the file and zip it, however, when I deploy to the existing stack which has been created, the stack does not detected any changes and my file is not updated.

It looks like AWS::CloudFormation::Init and Install only work once?

How should I go about updating and even adding a new file?

Upvotes: 2

Views: 1783

Answers (1)

Tim Bassett
Tim Bassett

Reputation: 1168

Please see this http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-hup.html

It will help you out.

Upvotes: 1

Related Questions