Fork me on GitHub

Hi, I am using the cognitect-labs/aws-api to deploy my resources on my AWS account. However, I have issue with the :Tags. The resource is created but without the tags.

(aws/invoke ec2-client {:op :CreateVpc
                        :request {:CidrBlock ""
                                  :Tags [{:Key "Name" :Value "my-vpc"}]}})
I tried with CreateSubnet, CreateInternetGateway etc, still the same result. Am I missing something?

Bingen Galartza Iparragirre08:01:27

According to the docs the CreateVPC API operation doesn't have a "Tags" option. You can check it in the docs site: It has something called "TagSpecification" which maybe is what you need? (never used it myself)

Bingen Galartza Iparragirre08:01:30

You can also run (aws/doc ec2-client :CreateVpc) to see the exact Clojure data structure that the aws-api client expects


The aws/doc or aws/op both show a Tags param:

 {:Tags [:seq-of {:Key string, :Value string}],
  :IsDefault boolean,
  :InstanceTenancy [:one-of ["default" "dedicated" "host"]],
  :CidrBlock string,
  :VpcId string}}


And when I :DescribeVpcs with Name tag I manually added via the Console, they do show in a :Tags param with same syntax as I tried above.

Bingen Galartza Iparragirre08:01:21

The aws/doc command shows both the Request and the Response. I can only see Tags in the Response section.


Oh got it:

(aws/invoke ec2-client {:op :CreateVpc
                        :request {:CidrBlock ""
                                  :TagSpecifications [{:ResourceType "vpc"
                                                       :Tags [{:Key "Name" :Value "my-vpc"}]}]}})
You were right, TagSpecification is what I needed. I just had to add the mandatory ResourceType Thank you


Is there already a way to easily convert a dynamoDB response map with types to one without?

👀 2
Dimitar Uzunov10:01:15

Which API are you using? There should be methods to marshall and unmarshall dynamodb JSON


Cognitect's api, don't see support for marhsalling


I see amazonica's ddb client supports marhalling

Dimitar Uzunov22:01:48

or if you use interop with JS or Java


@UBTMXD33J I'm not sure what you're after here. What response are you getting and what do you want it to be?


I was looking if something like this was already available

👍 2