skip to Main Content

I am attempting to change the node type of Elasticache from older generation (cache.t2.) to newer generation (cache.t3.) using Terraform.

Able to modify the node types successfully for all of Memcached instances via terraform apply, but unfortunately when I attempt to change the node type of Redis using terraform apply the command reaches completion in just ~30s and no change is applied.

To apply the node types change I have to login to web console and click individual Redis instance & click modify and apply the pending changes and wait for it to complete. This is manual work for me, I have to do this for 100 Redis instances.

Is it possible to force terraform to apply the pending changes for Redis on Elasticache?.

2

Answers


  1. Chosen as BEST ANSWER

    For me Terraform's apply immediately is not working so I am using the aws-cli to apply changes immediately.

    The below shell commands will identify the pending changes on all clusters and submit apply immediately on each cluster instance.

    PRFIL="profile1"
    RGN="eu-west-1"
    
    for cls in `aws-okta exec $PRFIL -- aws --region $RGN elasticache describe-cache-clusters | jq '.CacheClusters | .[] | select((.PendingModifiedValues | length ) > 0 and (.CacheClusterStatus!="modifying")) | .ReplicationGroupId ' | sort | uniq `  
      do
      echo $cls
      echo "aws-okta exec $PRFIL -- aws --region $RGN elasticache modify-replication-group --replication-group-id $cls --apply-immediately" | bash -vx | jq '.ReplicationGroup.Status'
    done 
    

Please signup or login to give your own answer.
Back To Top
Search