question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ssm put_parameter add to default

See original GitHub issue

Hi,

I have been trying to understand how to add the following ssm parameter to the default sets provided in https://github.com/spulec/moto/blob/master/moto/ssm/resources/ami-amazon-linux-latest/eu-west-1.json:

  • /aws/service/ecs/optimized-ami/amazon-linux-2/recommended

But obviously this isn’t possible by just calling put_parameter as showing in https://github.com/spulec/moto/blob/master/tests/test_ssm/test_ssm_boto3.py#L390

Is there an obvious way to do this with moto, or do I need to mock the ssm client without moto?

The result value from aws cli should be the following (at the time or writing):

{
    "Parameter": {
        "Name": "/aws/service/ecs/optimized-ami/amazon-linux-2/recommended",
        "Type": "String",
        "Value": "{\"ecs_agent_version\":\"1.63.1\",\"ecs_runtime_version\":\"Docker version 20.10.13\",\"image_id\":\"ami-002e2fef4b94f8fd0\",\"image_name\":\"amzn2-ami-ecs-hvm-2.0.20220921-x86_64-ebs\",\"image_version\":\"2.0.20220921\",\"os\":\"Amazon Linux 2\",\"schema_version\":1,\"source_image_name\":\"amzn2-ami-minimal-hvm-2.0.20220912.1-x86_64-ebs\"}",
        "Version": 94,
        "LastModifiedDate": 1664230158.399,
        "ARN": "arn:aws:ssm:eu-west-1::parameter/aws/service/ecs/optimized-ami/amazon-linux-2/recommended",
        "DataType": "text"
    }
}

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
bblommerscommented, Oct 7, 2022

Moto intercepts the underlying HTTP request that is send by the SDK, and the AWS CLI/boto3 will then convert the HTTP response to whatever format they want. I haven’t checked, but I’m assuming that the HTTP response from AWS contains a timestamp, so that’s what Moto should return as well

1reaction
bblommerscommented, Oct 5, 2022

The exact location where to store the data doesn’t matter much, as long as the naming is sensible, for example moto/ssm/resources/ecs/.

If there is no difference, than we might as well retrieve everything under /aws/service/ecs - if AWS decides to add more data, we’re already set-up to retrieve it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PutParameter - AWS Systems Manager
Add a parameter to the system. ... aws:ssm:integration ... To use your default AWS KMS key, choose the SecureString data type, and do...
Read more >
put-parameter — AWS CLI 2.0.33 Command Reference
You can reference a parameter version ID in API actions or in Systems Manager documents (SSM documents). By default, if you don't specify...
Read more >
07 best practices when using AWS SSM Parameter Store
As you know, AWS Lambda supports native environment variables, you can easy to define and add any environment variables you want during ...
Read more >
christippett/ssm-parameter-store: A simple Python ... - GitHub
set default AWS region AWS_DEFAULT_REGION=us-west-2 # add parameters aws ssm put-parameter --name "param1" --value "value1" --type SecureString aws ssm ...
Read more >
Pipe file directly to AWS SSM parameter store? - Stack Overflow
Rather than taking the value from stdin can you directly add to the command line arguments? aws ssm put-parameter \ --region ap-southeast-1 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found