aws

Loic 2023-01-11T07:05:06.043259Z

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 "192.168.0.0/16"
                                  :Tags [{:Key "Name" :Value "my-vpc"}]}})
I tried with CreateSubnet, CreateInternetGateway etc, still the same result. Am I missing something?

Bingen Galartza Iparragirre 2023-01-11T08:03:27.448979Z

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

Bingen Galartza Iparragirre 2023-01-11T08:04:30.618269Z

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

Loic 2023-01-11T08:11:50.174679Z

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

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

Loic 2023-01-11T08:13:45.848289Z

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 Iparragirre 2023-01-11T08:25:21.287709Z

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

Loic 2023-01-11T09:17:08.442629Z

Oh got it:

(aws/invoke ec2-client {:op :CreateVpc
                        :request {:CidrBlock "192.168.0.0/16"
                                  :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

Bingen Galartza Iparragirre 2023-01-11T09:40:07.453229Z

Great!

vasilisk 2023-01-11T19:07:49.436239Z

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

πŸ‘€ 1
Dimitar Uzunov 2023-01-12T10:34:15.577139Z

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

vasilisk 2023-01-12T18:07:42.972949Z

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

vasilisk 2023-01-19T23:38:40.306739Z

I was looking if something like this https://github.com/ctorrisi/franklin/blob/master/src/franklin/core.clj#L56-L72 was already available

πŸ‘ 1
2023-01-16T11:21:52.461709Z

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

vasilisk 2023-01-13T21:13:08.494329Z

I see amazonica's ddb client supports marhalling

Dimitar Uzunov 2023-01-13T22:02:48.798059Z

or if you use interop with JS or Java

Dimitar Uzunov 2023-01-13T23:36:38.273599Z

Hmm this doesn’t look too hard: https://github.com/aws/aws-sdk-js-v3/blob/6d48f1be73d63eeddef4cf10f1b05d313f9e1495/packages/util-dynamodb/src/convertToNative.ts#L12

πŸ‘ 1