Skip to content

Instantly share code, notes, and snippets.

@toddlers
toddlers / terraform_information.md
Last active January 20, 2021 14:16
terraform 0.13.4 with aws provider v3.16.0

terraform version

✔ ~/src/old_tf
11:36 $ terraform --version
Terraform v0.13.4
+ provider registry.terraform.io/hashicorp/aws v3.16.0

Your version of Terraform is out of date! The latest version
is 0.14.4. You can update by downloading from https://www.terraform.io/downloads.html
@toddlers
toddlers / stepfunction.json
Created January 14, 2021 16:39
new state machine with execution name only
{
"Comment": "Defines the statemachine.",
"StartAt": "SageMaker CreateTransformJob",
"States": {
"SageMaker CreateTransformJob": {
"Type": "Task",
"Resource": "arn:aws:states:::sagemaker:createTransformJob.sync",
"Parameters": {
"BatchStrategy": "SingleRecord",
"DataProcessing": {
@toddlers
toddlers / cfn.yml
Created January 12, 2021 14:14
ec2 userdata cloudformation
---
AWSTemplateFormatVersion: '2010-09-09'
Description: Persistantly sets the hostname of a RHEL7 EC2 instance on start
Mappings:
RegionMap:
us-east-1:
'32': ami-6411e20d
'64': ami-7a11e213
us-west-1:
'32': ami-c9c7978c
@toddlers
toddlers / eventname.list
Created January 12, 2021 09:58
cloud trail event names
AbortDocumentVersionUpload
AbortEnvironmentUpdate
AbortMultipartUpload
AbortVaultLock
AcceptAccountMapping
AcceptCertificateTransfer
AcceptDelegate
AcceptDirectConnectGatewayAssociationProposal
AcceptFxPaymentCurrencyTermsAndConditions
AcceptHandshake
@toddlers
toddlers / rmq.py
Last active January 8, 2021 15:08
rabbitmq connect
In [24]: node = pika.URLParameters('amqps://<>.mq.us-east-1.amazonaws.com:5671')
In [25]: conn = pika.BlockingConnection([node])
Pika version 1.1.0 connecting to ('<>', 5671)
Socket connected: <socket.socket fd=17, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.178.45', 50679), raddr=('<>', 5671)>
SSL handshake completed successfully: <ssl.SSLSocket fd=17, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.178.45', 50679), raddr=('<>', 5671)>
Streaming transport linked up: (<pika.adapters.utils.io_services_utils._AsyncSSLTransport object at 0x110918ee0>, _StreamingProtocolShim: <SelectConnection PROTOCOL transport=<pika.adapters.utils.io_services_utils._AsyncSSLTransport object at 0x110918ee0> params=<URLParameters host=<>.mq.us-east-1.amazonaws.com port=5671 virtual_host=/ ssl=True>>).
Aborting transport connection: state=1; <ssl.SSLSocket fd=17, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.178.45',
@toddlers
toddlers / stepfunction.json
Created January 7, 2021 11:58
intrinsic functions
{
"Comment": "A Catch example of the Amazon States Language using an AWS Lambda Function",
"StartAt": "nextstep",
"States": {
"nextstep": {
"Type": "Task",
"Resource": "arn:aws:lambda:eu-central-1:1234567890:function:catcherror",
"Parameters": {
"executionId.$": "States.Format('somestring {}', $$.Execution.Id)"
},
@toddlers
toddlers / pipeline.yml
Last active June 30, 2022 13:00
bitbucket pipeline with aws credentials
pipelines:
- step:
script:
# assuming the base image which is pulled from ecr has aws cli installed
- export AWS_PROFILE=deployment
# aws login
- eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email)
# docker
- export BUILD_ID=$BITBUCKET_BRANCH_$BITBUCKET_COMMIT_$BITBUCKET_BUILD_NUMBER
- docker build -t ${AWS_REGISTRY_URL}:$BUILD_ID .
@toddlers
toddlers / cfn.yml
Last active April 14, 2024 07:26
aws api gateway with step function execution
AWSTemplateFormatVersion: 2010-09-09
Description: My API Gateway and Lambda function
Parameters:
apiGatewayName:
Type: String
Default: my-api
apiGatewayStageName:
Type: String
AllowedPattern: "[a-z0-9]+"
@toddlers
toddlers / network-firewall-rule-group-error.txt
Created November 27, 2020 20:21
Error while creating the aws network firewall rule group with optional fields
aws_networkfirewall_rule_group.deny-http: Creating...
2020/11/27 21:19:37 [DEBUG] EvalApply: ProviderMeta config value set
2020/11/27 21:19:37 [DEBUG] aws_networkfirewall_rule_group.deny-http: applying the planned Create change
2020-11-27T21:19:37.025+0100 [DEBUG] plugin.terraform-provider-aws_v3.18.0_x5: 2020/11/27 21:19:37 [DEBUG] Creating NetworkFirewall Rule Group deny-http
2020-11-27T21:19:37.025+0100 [DEBUG] plugin.terraform-provider-aws_v3.18.0_x5: 2020/11/27 21:19:37 [DEBUG] [aws-sdk-go] DEBUG: Validate Request Network Firewall/CreateRuleGroup failed, not retrying, error InvalidParameter: 5 validation error(s) found.
2020-11-27T21:19:37.025+0100 [DEBUG] plugin.terraform-provider-aws_v3.18.0_x5: - missing required field, CreateRuleGroupInput.RuleGroup.RulesSource.StatefulRules[0].Header.Destination.
2020-11-27T21:19:37.025+0100 [DEBUG] plugin.terraform-provider-aws_v3.18.0_x5: - missing required field, CreateRuleGroupInput.RuleGroup.RulesSource.StatefulRules[0].Header.DestinationPort.
2020-11-27T21:19:
@toddlers
toddlers / README.md
Created November 23, 2020 10:42 — forked from avoidik/README.md
AWS query examples

Top 10 Examples of AWS CLI Query

List Volumes showing attachment using Dictionary Notation

$ aws ec2 describe-volumes \
  --query 'Volumes[*].{ID:VolumeId,InstanceId:Attachments[0].InstanceId,AZ:AvailabilityZone,Size:Size}'
[
    {
        "InstanceId": "i-a071c394",