I encountered an issue today where my email configuration, which is stored in the SSM parameter store, didn't reflect my new Gmail password for SMTP until I forced a new deployment. It seems to work just fine locally with Docker containers. Am I missing something about how Fargate tasks handle SSM parameters? Is there some kind of caching involved? Here's the code I'm using:
```python
session = (
boto3.Session(profile_name=os.getenv("AWS_PROFILE"))
if os.getenv("AWS_PROFILE")
else boto3.Session()
)
param_path = f"/abc/ffaasf"
ssm = session.client("ssm", region_name=AWS_REGION_NAME)
response = ssm.get_parameter(Name=param_path, WithDecryption=True)
```
3 Answers
You might want to fetch the SSM parameters directly using the API instead of depending on the task definition. If you're only pulling the values when the task starts, it'll stick with the old ones until you redeploy.
Just a heads-up: if your SSM parameters are defined in the task definition, Fargate only retrieves them at task initialization. You’ll have to redeploy to get the updated values.
I get that! I fetch them via Python as mentioned before.
It all depends on how you're fetching the parameters. Can you give me more details about your setup? That would help troubleshoot better!
I'm actually fetching them using the code I shared earlier.