Skip to content

Instantly share code, notes, and snippets.

View SlootSantos's full-sized avatar
😎
Rollin'

Flosloot SlootSantos

😎
Rollin'
View GitHub Profile
package main
import (
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/lambda"
"github.com/aws/aws-sdk-go/service/s3"
package main
import (
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/iam"
"github.com/aws/aws-sdk-go/service/s3"
)
package main
import (
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
package main
import (
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
package main
import (
"log"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
)
func main() {
resource "aws_iam_role" "iam_for_lambda" {
name = "iam_for_lambda"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "APP_NAME",
"image": "ACCOUNT_ID.dkr.ecr.REGION.amazonaws.com/REGISTRY/IMG_NAME",
"essential": true,
"memory": 128,
"portMappings": [
{
# login to ECR which sets a auth token to the ENV
$(aws ecr get-login --no-include-email --region REGION)
# build the container the way you always build it
docker build -t REGISTRY/IMG_NAME:latest -f "${PWD}/Dockerfile" ${PWD}
# get your latest image's ID
IMAGE_ID=$(docker images -q REGISTRY/IMG_NAME:latest)
ECR_URL=YOUR_ECR_URL
#!/usr/bin/env bash
# This fetches the AWS CLI
# inflates it
# and sets location to the path
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
# set the credentials to the default AWS CLI configuration file
aws elasticbeanstalk update-environment \
--application-name YOUR_BEANSTALK_APPLICATION_NAME \
--environment-name YOUR_BEANSTALK_ENVIRONMENT_NAME \
--version-label v$CIRCLE_BUILD_NUM \
--region=REGION