Usually in the AWS SDK you just deal with int or float and pointers to them.

So an int (short for integer) is a number without a floating point:

i := 5
var j int

What do you think j has as value? Find out with the sources (see below)!

And a float is:

f := 12.1

Different from not so strongly typed languages, combining int and float is not valid:

i := 5
f := 12.1
notOk := i + f

This is not valid

./main.go:15:13: invalid operation: i + f (mismatched types int and float64)

To combine variables with different types, you need to convert them:

i := 5
var f2 float64 = float64(i)

The CDK often uses pointers to float. As an example, to set the memory size of a lambda function you use the SDK again: aws.Float64(1024) to set the memory to 1 MByte.

        MemorySize:                   aws.Float64(1024),
        Code:                         awslambda.Code_FromAsset(&lambdaPath, 
        Handler:                      aws.String("hello.handler"),
        Runtime:                      awslambda.Runtime_NODEJS_14_X(),

Currently (Sep 2021) this is a float, although in the AWS Lambda API specification it is an Integer.

See also


See the full source on github.